[gdal-dev] Unable to extract features from KML

jratike80 jukka.rahkonen at maanmittauslaitos.fi
Sun Nov 20 23:30:18 PST 2016


Hi,

The main problem is that KML support such data models which do not suit well
with the simple feature model of GDAL. You can get some information about
that by reading http://www.gdal.org/drv_libkml.html.

In your case each feature has two geometries: one point and one polygon.
Best that can be done with the simple feature model it to push them both
into one geometry which in that case must be a geometry collection. Here is
one example from your data

GEOMETRYCOLLECTION (POINT (-1.282 87.1064),POLYGON ((3.02457 87.0792,2.22294
86.9806,-5.655 87.1168,-5.098 87.2201,3.02457 87.0792)))

You can save geometry collections into PostGIS if you use ogr2ogr with
switch "-nlt geometry". However, saving geometry collections into PostGIS
may not solve your problem because only few GIS programs can handle geometry
collections well.

A better option for you might be to explode the collections and save points
and polygons as separate features into PostGIS. The ogr2ogr command to use
is like

ogr2ogr -f PGDump output_pgdump -nlt geometry -explodecollections
Beyer_Hirise_Areas_KML/MC-01-0-0-0.kml

If you want to have a quick look at your data, use JML as outputformat and
open the result with OpenJUMP. It shows both the geometry collections and
exploded collections fine for me with names and descriptions.

-Jukka Rahkonen-



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-Unable-to-extract-features-from-KML-tp5296670p5296708.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list