Google Maps mangling KML

那年仲夏 提交于 2019-12-02 02:27:56

问题


I've created KML files of some world regions for display using the Google Maps API. This has been working fine, but one region has recently started displaying as if the data's corrupt. You can see what I mean here:

https://drive.google.com/file/d/0B9u3tNbtEyFRMTdwQTdEa0U5S2s/view?pli=1

If I load the same KML in Google My Maps it still displays correctly:

https://www.google.com/maps/d/viewer?mid=z8mYjxPmAgBQ.kGn7mza0JOSU

It used to display fine, but now even if I roll back to previous versions of the file it displays in this weird way.

The KML regions are created using QGIS's Vector > Geoprocessing Tools > Dissolve tool to merge countries (to shp files), which I then save off as KML. Data is from Natural Earth's ne_50m_admin_0_countries data set.

Does anyone know what might be going wrong?


回答1:


I would say that the Google Maps KML rendering engine has some issues. It works when I use the geoxml3 third party parser to render it, but not when I use the Google Maps Javascript API v3 KmlLayer to render it.

rendered with geoxml3

Note that the performance with third party parsers will depend on the complexity of the KML. Tile base rendering like used in KmlLayer will almost always perform better.

issue #8003 in the Google Maps Javascript API ve issue tracker




回答2:


I thought I was going crazy. This was working for years until some days ago. I agree it seems to be where polygons cross the "international date line" or anti-meridian. I see straight lines horizontally across the map. Furthermore I swapped out my KML file for another from a different source, SAME problem. Thanks for restoring my sanity, I wasted a stressful day trying to fix this, I think it is a Google problem. ps. they work fine in Google Earth.



来源:https://stackoverflow.com/questions/30224755/google-maps-mangling-kml

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