简体   繁体   English

我可以使用 JavaScript 中的本地路径在 GoogleMaps 中添加 KML 文件吗?

[英]Can I add a KML file in GoogleMaps with a local path in JavaScript?

Below is my JavaScript code.下面是我的 JavaScript 代码。
Please localize my path thrown by my open .kml file in GoogleMaps:请本地化我在 GoogleMaps 中打开的.kml文件抛出的路径:

function initMap() {

    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 11,
      center: {lat: 23.026261,  lng: 72.566872}
    });     

    var ctaLayer = new google.maps.KmlLayer({
     url: 'http://exaple.com//aa.kml',
      map: map
    });
}

My questions are:我的问题是:
Can I add a local path in JavaScript?我可以在 JavaScript 中添加本地路径吗?
Can I add a dynamic change to a .kml file in JavaScript?我可以在 JavaScript 中向.kml文件添加动态更改吗?

Google processes KML layers on their servers and returns tile imagery for KML layers you provided. Google 在其服务器上处理 KML 图层并返回您提供的 KML 图层的图块图像。 In order to process KML on server side they need upload your KML file to their server.为了在服务器端处理 KML,他们需要将您的 KML 文件上传到他们的服务器。 That means you cannot use URL that is not accessible publicly from the web, so local path won't work.这意味着您不能使用无法从网络公开访问的 URL,因此本地路径将不起作用。

Unfortunately, you cannot use local paths in KML layers.不幸的是,您不能在 KML 图层中使用本地路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM