Sunday, January 17, 2010

Hacking Google maps AJAX API to use in C#.Net

Hi,
As you know “Google Maps API” is available only for AJAX developers. Using it in C#.net is not possible. One of the great things about Google maps API is it gives you turn by turn direction almost anywhere on earth. I wanted to exploit this feature of turn by turn navigation on my mobile, that too offline, because when i go to remote places its highly probable that i will not be having connectivity on my phone. Or connectivity will be so poor that using maps is highly impractical.

So I have created a pair of application.
1. A Desktop app to retrieve turn by turn navigation data + static images.
2. A Mobile app to read this data and to give me turn by turn navigation on phone (offline).

Certainly this is something not allowed in TOU of Google, so i cannot release this app commercially.

How to Mix AJAX and C#.net??
1. I created a web page (html+JavaScript), which dumps the direction info data in DOM.
2.In C#.Net Form, I kept a web-browser control, which loads this page.
3.When page is loaded, using webBrowser1.Document.GetElementById stuff I extracted the direction info.
4.Then I downloaded Static Images using "Google Static Maps API", & hacked to get the latitude and longitude positions on the static images. see code for detail.


How I exported data on mobile??
1. Serialized whole object in an XML file, including direction info and static images.
2. De-serialized on mobile to get that data back.


Source Code
http://code.google.com/p/pocketnavigator/


Screen-shot Of Mobile Version.



Demo of Desktop App (6 minute).

Thanks, Feel free to ask question, & share on twitter + digg & blah blah.

No comments:

Post a Comment