Skip to content Skip to sidebar Skip to footer

Google Maps KML Layer Won't Read Kml

I'm trying to read a simple KML with Google Maps API 3, I created KML file in Google Maps Editor, codes are google sample, i can't find where is problem. gm-sample.html BTM.kml fun

Solution 1:

The link provided for the KML on github.com is being served with a MIME type of "text/plain", it should be "application/vnd.google-earth.kml+xml"

3 KML MIME Types
When responding to a request from Google Earth (or any Earth browser), a KML server must follow a certain set of rules so that Google Earth can correctly interpret its responses.

Upon success, the server must return a response code of HTTP 200 and set the response's content-type to a suitable MIME type, as described here.

Google Earth reads KML and KMZ files. The MIME type for KML files is application/vnd.google-earth.kml+xml

The MIME type for KMZ files is
application/vnd.google-earth.kmz

validator results:

Recommendations

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

Feeds should not be served with the "text/plain" media type

If I copy your KML to my server (which serves KML with the correct MIME type), it works

BTW - If I point the validator to the link in the code in your question, it doesn't work at all, it isn't a KML file, but if I point the KmlLayer URL to that, it also works


Post a Comment for "Google Maps KML Layer Won't Read Kml"