From KML 2.1 to GML, Shapefile, whatever you like…

I have used a lot of times this method from Matt Perry for converting KML files to GML or anything readable by OGR (currently OGR can just write to KML 2.0, not read it).

Yesterday I was interested in viewing the Pleiades dataset, that can be downloaded in KML format. The mentioned method wasn’t working and gave strange results (e.g. < and > converted to &lt; and &gt;, no XML tags). It took me an hour before I noticed that the sed one-liner for getting rid of the KML namespace wasn’t working just because it was looking for 2.0 instead of 2.1, which is what I had and actually the most common version you find. This was driving the XSL parser mad.

So, just change that one character, or delete by hand the xmlns declaration in your file, letting the <kml> tag alone.


Commenti

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.