I'm trying to use OpenLayers' KML reader to display a KML file on a map, but the KML itself has LinearRings that have a tessellate value of 1. I realize that this is used by google earth to snap the object to the ground for a more accurate drawing, but it causes the KML to be useless as far as the OpenLayers KML reader is concerned.

So my question then is, what can be done to convert these tessellated regions? I'm assuming there's not simply a setting I can change in OpenLayers to have it properly display the regions without tessellation.

  • How are you using the reader? Do you have a code snippet?
    – CaptDragon
    Feb 2 '12 at 15:09

If you are passing in the KML as a string you can use .replace() function in javascript to manipulate it however you like. Whether it be remove the element or change it's value.

For example to remove all tessellate elements:

myKML = myKML.replace(/<tessellate>1</tessellate>/g, '');

Working with KML and openlayers once, I had to write a Python script to re-arrange my KML file as wanted and remove unwanted nodes.

For that, I simply use elementTree library. Here is a tutorial.

I think removing undesired nodes into the kml file itself is good since it makes the source file lighter.

I'm very new with Python, so my script is probably not so nice but it does the job! So if you are interested to have a look on it, I can share it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.