本文介绍了为什么KML无法在Google地图中加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个KML文件,我正尝试将其加载到Google地图中。它放大了水中的某处,没有路线痕迹。这是我尝试的代码:

  var kmlLayer = new google.maps.KmlLayer(kml); 
kmlLayer.setMap(this.googlemap);

this.googlemap有一个Google地图对象。这是一个非常简单的例子,但也许我错过了一些东西,或者我的KML格式不正确。我的KML文件可以在这里下载: 。任何人都可以提供帮助吗?

解决方案

Google Map需要能够访问这个KML文件direclty,换句话说,您的KML文件必须公开发布,并且必须以.kml或.kmz扩展名结尾(我相信)。

为了确保KML文件本身是正确的,您可以随时浏览地图.google.com并将该网址放到搜索栏中,它应该被自动识别并呈现。


I have a KML file that I am trying to load into Google maps. It zooms somewhere in the water with no route trace. This is the code I am trying:

    var kmlLayer = new google.maps.KmlLayer(kml);
    kmlLayer.setMap(this.googlemap);

"this.googlemap" has a Google map object. It is very simple example, but maybe I am missing something or my KML is not in the right format. My KML file can be download here: http://temp-share.com/show/gFHKdyG0Y. Can anyone help?

解决方案

Google Map needs to be able to access this KML file direclty, in other words, your KML file must be publicly available, and must end with .kml or .kmz extensions (I believe).

To make sure the KML file itself is correct, you can always go to maps.google.com and put the URL in the search bar, it should be automatically recognized and rendered.

这篇关于为什么KML无法在Google地图中加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 04:34