[gdal-dev] Extract Linestrings from GeometryCollections with ogr2gor

Stefan Ziegler stefan.ziegler.de at gmail.com
Mon Mar 16 12:06:10 PDT 2015


Hi

I have some contour lines which I clip with ogr2ogr's -clipsrc options. As
a result and in very rare cases I get some GeometryCollections which cannot
be stored in a  shapefile.

So I'm clipping to a GeoPackage and tried to extract the LinesStrings from
the GeometryCollections with the following command:

ogr2ogr -dialect INDIRECT_SQLITE -sql 'SELECT ID, elev,
(ST_Dump(geom)).geom as geom FROM linestring WHERE geometrytype =
\'LINESTRING'\' clipped_dumped.shp clipped.gpkg

ST_Dump seems to be unknown (as SQlite does not support arrays I guess) so
is ST_CollectionExtract(geom,2).

Is there a way to extract LineStrings from GeometryCollections. Probably
already avoiding them when clipping the original geometry?

best regards
Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150316/b74ba6ae/attachment.html>


More information about the gdal-dev mailing list