[英]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.