javascript - 将谷歌我的地点 map 中的数据添加到自定义谷歌地图

标签 javascript google-maps google-maps-api-3 kml google-places-api

我用 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

你问:

  1. 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 文件的链接 谷歌的服务器。
  1. 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?
<小时/>

您可以通过单击已保存 map 中的 KML 链接来下载上述 KML,请参阅下图并注意最后一个链接 (KML)。

enter image description here

关于javascript - 将谷歌我的地点 map 中的数据添加到自定义谷歌地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11397758/

相关文章:

javascript - Google Map API - 如何在不刷新 map 的情况下过滤添加到 map 的标记?

javascript - 带有三元运算符的附加赋值运算符

javascript - 从 redux 中的 reducer 取回 ID

android - 后台服务中的 FusedLocationAPI

java - 为什么它不是我当前的位置,只有一个位置 37.4219983,-122.084?

google-maps - 如何使 flutter google map 中的标记随相机而不是 map 一起移动

javascript - 多条折线相互重叠 - 带一条 "to the front"

html - 如何使侧边栏适合窗口并使谷歌地图适合屏幕的其余部分?

javascript - 使 PHP 生成的 URL 可在 Javascript 函数中触发

javascript - 在扩展组件的数据中使用时,扩展组件的数据未定义