Access "My Maps" in Google Maps from Android
I want to write an app to display markers from one of my custom maps in Google Maps. How do I access this data? T开发者_如何学Pythonhere must be an API for it but I can't find information anywhere.
If you have created a Google My Maps map through the browser tools, you can just copy the link to your My Map and then pass it to the Google Map Application on the device.
Intent intent = new Intent("android.intent.action.VIEW");
intent.setComponent(ComponentName.unflattenFromString("com.google.android.apps.maps/com.google.android.maps.MapsActivity"));
intent.addCategory(android.intent.category.LAUNCHER);
// replace string with your Google My Map URL
intent.setData("Your Google My Map URL HERE");
startActivity(intent);
I don't believe that the MapView API supports My Maps, so one path is to use the Google Map application if you want to view your data.
Or you could export it out of My Maps as KML and parse it yourself for your app, but then you are responsible for putting down all of the POI markers, etc.
Update 2011-04-13:
If you add on the parameter 'output=kml' to your Google My Maps link URL you can get the KML file of your map. KML is just an XML file containing all of the points of interest on that map along with lat/long and details. Once you parse the file, do what you want with the data.
Update 2015-05-20:
Looks like the new version of Google My Maps has KML import and export capabilities. You can export as a KML file or a network link to the KML file.
See: Google My Maps - Export a map
It's called the Google Maps Data API:
But - there was talk of deprecating it although this seems to be under discussion: http://groups.google.com/group/google-maps-data-api/browse_thread/thread/98b695bbadfed1ee#
精彩评论