[gdal-dev] KML Parsing Performance

Christopher Condit condit at sdsc.edu
Fri Oct 10 13:32:11 EDT 2008


Hi Joel-
>I'd like to know how I may get better performance reading a KML file.  I have a >file with 9,640 points.  I've found that it takes about 16 seconds to read >through the entire file (see the code snapshot below).  The exact same data in >Shapefile format takes a second or less to read using the same code >snippet.  I'm using 1.5.2 with libexpat.  Any hints?  Thanks.

I think there are few problems here. One is that XML is inherently slow. Second, it looks as though the getFeature code is looping through each child incrementally. I'm more familiar with libXML2 than expat and sadly I'm not aware of xpath functionality for expat (mainly because it's a sax parser). I would bet that writing an xpath query to grab the nth placemark (and allowing the underlying xml engine to execute it) would be much faster than looping over all the children of the layer. I don't know of a quick solution at this time, but it would be good to get a copy of your sample data (if possible) and file a ticket against it...

-Chris

Christopher Condit
San Diego Supercomputer Center
858-822-5483
condit at sdsc.edu




More information about the gdal-dev mailing list