Wednesday, 6 August 2008

Google Maps JavaScript Intellisense

I'm working on a project that uses Google Maps extensively. I've used GM for basic stuff in the past but that was pre API Loader and Visual Studio 2008. The API Loader is cool, I like namespaces it keeps everything neat, GMap2 looked too much like COM programming. google.maps.Map2 is something I can get into.

The namespaces got me thinking, someone must have found a way to get Intellisence for google.maps. The closest I could find was a blog post by Roger Chapman, his solution is pre loader and hand written, rather than the scripted solutions for jQuery (thanks to the way jQuery is documented). That said, I am extremely grateful for work that must have been time consuming and Roger is to be commended. Roger Chapman I salute you.

I have taken Roger's original file and namespace'd it. I've added a few lines to the top of the file which declares google.maps and the the API Loader functionality. Then, using Find & Replace, I switched all those ugly capital Gs and G_s for google.maps. I've also added one or two additional classes that weren't included in Roger's original file. I'll continue to add more as and when I need to. I'd certainly appreciate any additional classes that other people have added. The current version of the file is available to download here.

I believe Roger has since created a CodePlex project for his work. If there is any interest in me doing so, I'll contact Roger with a view to forking the project for the API Loader variation.

3 comments:

Markus Olsson said...

Hi!

I started a made a little intellisense file for Google Maps version 3. Thought you might be interested.

http://blog.freakcode.com/2009/11/google-maps-version-3-intellisense.html

sky said...

I have built one as well with full API coverage @ http://gmapvsdoc.codeplex.com/

Richard Kimber said...

Thanks for both of the links, it's great to see APIs like this get the intellisense treatment. Our company has recently switched to Bing as our maps provider, for which there is an excellent vsdoc on CodePlex.