[Windows Mobile Software Development] howdykeith:
Starting Google Maps from another application with a run external button

remery Level 2 7/29/09

Hi, we've been using Visual CE as a PDA database and it works really well. We use a command button form within our database form to open Google Maps and jump to the lat long of the GPS coordinates for the records and show a placemark. Its worked great up until the latest version of Google Maps which jumps to the location fine but no placemark. Have Google changed something? I'll append the Visual CE code...

NOTE: In November 2007, Google has said that the following

information is preliminary and subject to change at any time.

Using Visual CE with Google Maps Mobile

You can easily connect Visual CE to Google Maps Mobile. Once connected, your users can navigate to a record with a location in it, press a button, and then see a map of that location or get directions to it. Clicking OK on the map will close Google Maps Mobile and return the user back to your Visual CE form.

First you need to download Google Maps Mobile and install it on the device. You can download Google Maps Mobile at no charge from the Google web site.

Then, on your Visual CE form, you would need two buttons (or macro steps) to do this. The first is used to formulate the query to send to Google Maps Mobile, the second launches Google Maps Mobile with that query.

For the step to formulate the query, you would use an ASSIGN operation. Most likely the column you are going to assign to will be a variable. If you want to display the map or satellite view of a specific location, the value you assign to that variable will look like something like this: -URL "?action=locn&a=Cambridge MA"

-URL "?action=locn&a=@latlon:-22.54,-43.14"

-URL "?action=locn&view=mapv&a=1600 Pennsylvania Ave Washington D.C."

-URL "?action=locn&view=satv&a=Statue of Liberty"

If you want to display the directions from one location to another (for example, from Harvard University to M.I.T.), the value you assign to that variable will look like something like this: -URL "?action=rout&start=Harvard University&end=M.I.T."

You can hard code one of these values (just enclose it in single quotes, as you would do for any other character string). Alternatively, you can use a expression to buld the character string dynamically at runtime. For example, if your table had a CITY and STATE column, you could use the expression: '-URL "?action=locn&a=' & CITY & ' ' & STATE & '"'

The keywords (URL, action, locn, rout, a, latlon, start, and end) have to be there. The view keyword is optional and you get your choice of map view (mapv) or satellite view (satv). All the keywords have to be lower case (except URL, which must be upper case). And note the hyphens, question marks, equal signs, ampersands, at-signs, colons, and double quotes.

You get quite a bit of leeway in how you can specify the location. You can put in the name of a city and state, a latitude and longitude (Rio de Janeiro is at 22.54 S, 43.14 W), a street address, or even a landmark.

For the step to launch Google Maps Mobile, you would use a RUN EXTERNAL operation. The command would run the Google Maps Mobile appliation. By default, it is installed in /Program Files/GoogleMaps/GoogleMaps.exe The argument would be the variable you assigned in the first step.

It's pretty simple really by using sendkeys.

In GMM, open:

Menu -> Search

Enter the lat,long and press Enter.

To extract the lat,long from the URL, take this example:

Code:

http://maps.google.co.nz/maps?f=q&s....748606,-73.985528&spn=0.003706,0.010267&z=17

You'll want to parse this part: &ll=40.748606,-73.985528&spn=

Once you got the lat,long, simply enter it into the search field and GMM will take you there.

Well, the structure of the URL and the order of the parameters might change depending on the program that generated the link, but in most cases the parameter is "ll".

Edit: Note that it's better to append "loc:" to the lat,long search query, eg "loc:40.748606,-73.985528" . This would work with off-road locations too, otherwise without the loc prefix it might just return the nearest road.

__________________