Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to use OpenLayers' KML reader to display a KML file on a map, but the KML itself has LinearRings tha 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 OL to have it properly display the regions without tessellation. Thanks.

share|improve this question
    
How are you using the reader? Do you have a code snippet? –  CaptDragon Feb 2 '12 at 15:09
add comment

2 Answers 2

up vote 2 down vote accepted

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, '');
share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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