[postgis-users] ogr2ogr and kml format

Frank Warmerdam warmerdam at pobox.com
Wed Jan 7 07:25:00 PST 2009


christophe triquet wrote:
> Hi everybody,
> 
> I'm trying to translate kml file into another format (postgresql or
> shp) with ogr2ogr. I'm working with kml files generated with google
> earth or google maps. When I use a kml file as input for ogrinfo or
> ogr2ogr, I get an error saying :
> 
> FAILURE:
> Unable to open datasource `my_file.kml' with the following drivers.
> ...
> 
> and then the list of availables drivers displays.
> 
> When I enter : ogrinfo --formats
> I get : -> "KML" (read/write)
> so it seems that this is well configured.
> 
> I've tried to validate my kml with www.kmlvalidator.com and the result
> is that there is differences between a file generated by google earth
> and the ogr kml format. After correcting the errors found by
> kmlvalidator, the validation is successfull but ogr2ogr still doesn't
> work (with the same error message).
> 
> Does someone have any suggestion to solve my problem ?

Christophe,

Unfortunately OGR does not have a way of knowing for the purposes of
reporting if a driver is "write only".  The KML driver is write only if
OGR is not built with support for the XML parsing library used by the
KML driver (expat).  So I suspect you need to rebuild GDAL/OGR with
support for the expat library (--with-expat to configure) in order to
get this working.

Even at that there are definate limitations in the KML reading.

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 postgis-users mailing list