我需要根据特定条件在 Google Maps API map 上显示大量 KML 文件。
当我尝试添加这些 KML 文件时,我最终遇到了 Google map 和 KML 图层的一些限制。
我试过使用缩短的 URL、PHP 脚本、缩短的 URL 和 PHP 脚本,但似乎没有任何东西可以解决问题,我仍然在几秒钟内达到极限...
最佳答案
来自documentation :
Number of KML layers
There is a limit on the number of KML Layers that can be displayed on a single Google Map. If you exceed this limit, none of your layers will appear on the map, and an error will be reported in your web browser's JavaScript console. The limit is based on a combination of the number of KMLLayer classes created and the total length of all the URLs used to create those layers. Each new KMLLayer you create will take up a portion of the limit for the layer and a further portion of the limit depending on the length of the URL where the KML file was loaded from. Consequently, the number of layers you can add will vary by application; on average, you should be able to load between 10 and 20 layers without hitting the limit. If you still hit the limit, use a URL shortner (such as https://goo.gl) to shorten the KML URLs. Alternatively, create a single KML file consisting of NetworkLinks to the individual KML URLs.
关于javascript - Google Maps API KML 图层限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45386187/