Query existing, public Google Map via the Google M

2020-07-17 16:45发布

I am trying to embed an existing, public Google Map into a website. Specifically this one: http://goo.gl/maps/cHf2

Of course I could use the iframe embed to achieve this, but I would like a little more control over the map … I imagined being able to pull all the markers from the map and display them as an index next to the map. Kind of like Google already does, but embedded in my page with my own styles and images.

I have been digging through Google, Stack Overflow and the API instructions and couldn’t find any relevant posts. In the GET string of the map on Google we can see this chunk:

&msid=212828439842926497866.0004bfae4da003d8ffd1f&mid=1341413217

I thought in there might be a maps ID and I could use it to query the content of the map through the API? The intention is using Google Maps as a CMS for less technical minded people and not dealing with geo data in our own CMS.

Any help would be greatly appreciated. Maybe I am just missing the forest for the trees.

1条回答
Emotional °昔
2楼-- · 2020-07-17 17:01

You can download the kml that specifies the markers in that page and display that on your API based map. This example defaults to displaying it using geoxml3, but you can hide that and display the KmlLayer version.

You should be able to just point KmlLayer to the link (I downloaded the kml and put it on my server so it would work with geoxml3).

Here is an example (taken directly from the documentation) that does that

here is the original

查看更多
登录 后发表回答