[FWTools] ogr2ogr kml to shape conversion problems

Frank Warmerdam warmerdam at pobox.com
Wed Oct 29 19:28:20 EDT 2008


Travis Kirstine wrote:
> I having some difficulty converting large kml files to esri
> shapefiles.  I have no difficulting converting a tile index with
> ~100,000 features to a kml however converting the kml back to a
> shapefile just seems to hang.  ogrinfo does not even work on the kml
> file.
> 
> shp -> kml works
> ogr2ogr -f KML tileindex.kml tileindex.shp
> 
> kml -> shp fails
> ogr2ogr ogrtileindex.shp tileindex.kml
> 
> I tried just using the ogr api just retrieve kml geometryref() to
> create the new file but I had the same results, the script hangs as
> soon as I open the kml file.
> 
> Is there a workaround or is this a limitation of the kml driver?

Travis,

Brian Hamlin and I dug into this a bit and it appears the KML reader
in OGR parsers the whole KML file into a memory representation on
open.  This means large files will use large amounts of memory ... likely
a substantial amount more than the actual file size.

So I imagine the KML driver is just not suitable for reading large KML
files as it is currently implemented.

I would add this is not typical of other OGR drivers (like Shapefile,
or even GML).

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the FWTools mailing list