Access “My Maps” in Google Maps from Android

假装没事ソ 提交于 2021-02-07 09:34:00

问题


I want to write an app to display markers from one of my custom maps in Google Maps. How do I access this data? There must be an API for it but I can't find information anywhere.


回答1:


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




回答2:


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#



来源:https://stackoverflow.com/questions/5627181/access-my-maps-in-google-maps-from-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!