Using KMZ Files in Google Maps

后端 未结 2 2045
-上瘾入骨i
-上瘾入骨i 2021-02-04 09:28

Is there any way I can use a KMZ file in Google Maps? My KML file is around 10.7MB so it doesn\'t load on Google Maps. KMZ file is around 2MB. The only way I see it is to have m

2条回答
  •  再見小時候
    2021-02-04 10:19

    Yes, you can specify a KMZ file using the Maps API:

    var kmzLayer = new google.maps.KmlLayer('http://www.kmzlinks.com/redirect.asp?id=110&file=PalmIsland%2Ekmz');
    kmzLayer.setMap(map);
    

    In your specific case, your script should look like this:

    
    

    BUT - your KML is too big. Even though it's compressed down to 2MB as a KMZ, Maps looks at the size after it's been decompressed, and in your case that's bigger than 10MB. Try cutting it down a bit - if you replace your KMZ URL with the one in the first snippet above, it will work. Looks like you'll need to use multiple KML files. Perhaps you could load the KMZ into Google Earth, then save each province as its own file (right-click on the folder in Earth's "Places" tab, and select Save as...)

提交回复
热议问题