Friday, December 14, 2012

How to use the Google map image



You can use the map from Google. To do that you just create an image object and set its source property to:
http://maps.google.com/staticmap?center=48.8566667,2.3509871&format=png32&zoom=14&size=480x640&key=(your Google Map Key)
You can get your Google Map Key from the site: http://code.google.com/intl/fr/apis/maps/signup.html

center is the latitude and longitude position in degree of the map center. You can define two variables $lat_var and $lon_var to get a map in a position entered dynamically by the user:
http://maps.google.com/staticmap?center={$lat_var},{$lon_var}&format=png32&zoom=14&size=480x640&key=(your Google Map Key Here)
See the GoogleMapDemo.eman sample enclosed with the JM-Mobile Editor for more detail.
From the version v1.3.15, JM-Mobile Editor allows to get the current GPS location of device through the system GPS variables such as $SysLastGPS.L, $SysLastGPS.G, etc. (see the GpsSysVar sample for more detail about the usage of the system GPS variables).
You can use these system GPS variables to get the Google map of current position of device. You should just replace the $lat_var and $lon_var variables above by the $SysLastGPS.L, $SysLastGPS.G system GPS variables as like as the following URL specification:
http://maps.google.com/staticmap?center={$SysLastGPS.L},{$SysLastGPS.G}&format=png32&zoom=14&size=480x640&key=(your Google Map Key Here)

No comments:

Post a Comment