Hi, Thanks for this !
I eventually realised that I'd got in a muddle because I had failed to understand what "wkb_geometry" is ( https://en.wikipedia.org/wiki/Well-known_text ). I think I thought it was the gdal way for setting the SRID or something like this. So after seeing the light I am using ... ogr2ogr -f PostgreSQL PG:"dbname=original_hirise" -nlt geometry MC-01-0-0-0_1.kml SELECT ST_AsText(wkb_geometry) FROM mc_01_0_0_0_1; ... shows ... GEOMETRYCOLLECTION(POINT(-30.415 88.0473),POLYGON((-28.14 87.938,-31.75 87.9205,-32.947 88.1536,-28.884 88.1731,-28.14 87.938))). [...] I'll be using PHP so the multigeometry should be fine for the moment and seems easy enough to access ... SELECT * FROM mc_01_0_0_0_1 WHERE ST_DWithin(ST_CollectionExtract(wkb_geometry, 1), ST_SetSRID(ST_MakePoint(-30.332,87.4992), 4326), 0.2); ... which gives two results with the correct coordinates. Sorted ! (as we say here). Best Michael Z Freeman On Mon, November 21, 2016 7:30 am, jratike80 wrote: > 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-f > rom-KML-tp5296670p5296708.html Sent from the GDAL - Dev mailing list > archive at Nabble.com. _______________________________________________ > gdal-dev mailing list [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
