我用 JavaScript 制作了一个定制的谷歌地图: http://resortstudio.ch/kontakt/
我想直接从个人 google-my-places-map 添加(导入)许多标记。 来自类似于此示例的内容:http://goo.gl/maps/0uRg
换句话说。我想将谷歌地图上保存的个人 map 中的数据导入到我的自定义样式 map 中。有没有一种简单的方法可以导入这些地点/标记,而无需将代码中的每个位置写入我的自定义 map ?
最佳答案
您可以使用KmlLayer in the google maps API v3导入 KML。有一个KML version of that map available .
Here is an example that displays the example you provided using the API v3
你问:
- Is there a way, to directly link to the KML-File on google maps instead of download/put the KML file on a server by myself?
- 上面的示例使用直接指向存储在以下位置的 kml 文件的链接 谷歌的服务器。
- When I load the KML-Layer, it ignores my defined "center" of the map. Same happens in your example above, where the "center" is set to Chicago, but is overwritten by the KML (NYC). Any way to overwrite the KML-center-setting?
- 设置preserveViewport在 KmlLayerOptions 中。
您可以通过单击已保存 map 中的 KML 链接来下载上述 KML,请参阅下图并注意最后一个链接 (KML)。
关于javascript - 将谷歌我的地点 map 中的数据添加到自定义谷歌地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11397758/