Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Google "My Maps" Layer to Google Maps Javascript API

Tags:

I want to put a Google Maps map on our website.

I know that custom markers can be added to a map with Javascript, but I'd rather use Google's MyMaps service instead, because then my co-workers could edit the map without any programming knowledge.

You can add a custom My Map to websites with an embedded iframe. I'm using the Javascript API instead though, so that I can take advantage of the controls the API delivers (such as zoom through custom controls or changing the position on the map without touching the map itself).

Can I insert the map created and saved with My Maps as a layer in my JS API map?

like image 886
Andy Jacobs Avatar asked Sep 24 '09 09:09

Andy Jacobs


People also ask

Can you customize Google Maps API?

The Google Maps APIs now support you in creating beautiful styled maps for your Android and iOS apps as well as your website using the same JSON style object.


1 Answers

You can use GGeoXml to add My Maps content to your API map.

In your My Map there's a "View in Google Earth" link, use the URL of that link as your GGeoXml URL.

The link generates an indirect "network link" reference to the data, so the map on your page will reflect the latest changes made to the My Map.

The downside is that there's a limit to how many markers you can place on one page of a My Map, and the "View in Google Earth" link only returns data for the current My Maps page.

like image 56
Mike Williams Avatar answered Sep 28 '22 08:09

Mike Williams