为什么我的 KML 文件不会显示在 Google 地图上?

发布于 2025-01-06 14:44:26 字数 268 浏览 2 评论 0原文

谁能告诉我为什么这个 kml 文件不会显示在谷歌地图上?

我使用以下代码将其添加到地图对象中,该对象似乎与其他 kml 文件配合得很好。

var kml = new google.maps.KmlLayer('http://www.emotination.com/kml/tasman.kml');
kml.setMap(map);

提要验证器说它有效,并且它对于谷歌服务器来说不是太大而无法解析?

地图直接放大到海洋中!

Can anyone tell me why this kml file won't display on google maps?

Im using the following code to add it to the map object which seems to work fine with other kml files.

var kml = new google.maps.KmlLayer('http://www.emotination.com/kml/tasman.kml');
kml.setMap(map);

Feed validator says its valid and it isn't too big for googles servers to parse?

The map just zooms right into the ocean!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无所的.畏惧 2025-01-13 14:44:26

您需要确保 Google 的服务器不会显示您的 kml 文件的缓存副本。

一个好的方法是执行 Björn 在他的评论中建议,只需添加一个时间戳即可在网址末尾添加:

var kml_tasman = new google.maps.KmlLayer('http://www.emotination.com/kml/tasman.kml?time='+new Date().getTime());
kml_tasman.setMap(map);

You need to ensure Google's servers aren't displaying a cached copy of your kml file

A good way to do this is to do what Björn suggests in his comment and just add a timestamp so the end of the url:

var kml_tasman = new google.maps.KmlLayer('http://www.emotination.com/kml/tasman.kml?time='+new Date().getTime());
kml_tasman.setMap(map);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文