![](/img/trans.png)
[英]Import local (on disk) KML file with Googlemaps js in web app
[英]Can I add a KML file in GoogleMaps with a local path in JavaScript?
下面是我的 JavaScript 代码。
请本地化我在 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
});
}
我的问题是:
我可以在 JavaScript 中添加本地路径吗?
我可以在 JavaScript 中向.kml
文件添加动态更改吗?
Google 在其服务器上处理 KML 图层并返回您提供的 KML 图层的图块图像。 为了在服务器端处理 KML,他们需要将您的 KML 文件上传到他们的服务器。 这意味着您不能使用无法从网络公开访问的 URL,因此本地路径将不起作用。
不幸的是,您不能在 KML 图层中使用本地路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.