mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

Tip of the Month (September 2007)
Note: Recently, Google changed the programmatic interface to Google Maps. A description of the new interface can be found here.

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:

    -TYPE "LOCN" -QUERY "Cambridge MA"
    -TYPE "LOCN" -QUERY "-22.54 -43.14"
    -TYPE "LOCN" -VIEW "MAPV" -QUERY "1600 Pennsylvania Ave Washington D.C."
    -TYPE "LOCN" -VIEW "SATV" -QUERY "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:
    -TYPE "ROUT" -VIEW "MAPV" -REF "Harvard University" -QUERY "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:
    '-TYPE "LOCN" -QUERY "' & CITY & ' ' & STATE & '"'

The keywords TYPE, LOCN, ROUT, REF, and QUERY have to be there. VIEW is optional and you get your choice of map view (MAPV) or satellite view (SATV). All the keywords have to be capitalized. And note the hyphens 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.