Issues with KML Layers limit

半城伤御伤魂 提交于 2020-01-14 10:27:28

问题


I have loaded 6 kml layers via url to my website to be toggled off/on by checkboxes. I have recently notice though, that it will only allow me to show 4 kml's at a given time. When I select more than 4 the 5th and 6th does not show. It does not matter what ones I choose, it seems to limit me to only showing 4. Can someone direct me on what may be causing this or should I be coding this some other way? The kml's by themselves do work and are under 800kb. Is just seems very weird that I can only have 4 kml showing at a given time.

This is the site - www.gbnrtc.org/bikemap


回答1:


If you check the KML Support page, which lists the level of KML support provided for Google Maps and Google Maps for mobile, it lists the following size and complexity restrictions:

  • Maximum fetched file size (raw KML, raw GeoRSS, or compressed KMZ): 3MB
  • Maximum uncompressed KML file size: 10MB
  • Maximum number of Network Links: 10
  • Maximum number of total document-wide features: 1,000

Given that you estimate your file size at ~800K, that would put you right around 3.2 MB for four of your files. Without knowing more about your KML content, it seems to make sense that the limit would gate you after loading four.




回答2:


This answer is quite old. I have found a great library to load large KML/KMZ files (even if Google is throwing an error). Please note that the library is quite old and have not received any update.

Here are more details about it:

Using GeoXML, I was able to add all the required KMLs to the map successfully! https://github.com/geocodezip/geoxml3

Step 1: Download and include geoxml3.js script

<script src="geoxml3.js"></script> // include after google map api script

Stpe 2: Instantiate and initialize the object in JS:

var myParser = new geoXML3.parser({map: map});
myParser.parse('/path/to/data.kml');

And this will load the KMl file.



来源:https://stackoverflow.com/questions/10804070/issues-with-kml-layers-limit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!