[gdal-dev] select shapes in a folder by geometry type

Pedro Costa pedrocostaarma at sapo.pt
Fri May 24 09:23:50 PDT 2013


Hi guys,

I'm trying  to make a script that converts 3d shapefiles to 2d.
I'm using the loop 'for...do'' and this command:

'ogr2ogr -f "ESRI Shapefile" -nlt POINT 2d_points/$shp $shp'

My problem is that i don't  know how to select only shapefiles of 
points, and next only polygons, and next only lines to put the right 
geometry in the command.
For example, i have tried the '-where "OGR_GEOMETRY='Point'"'  like that:

ogr2ogr -where "OGR_GEOMETRY='Point'" -f "ESRI Shapefile" -nlt POLYGON 
2d_poligonos/$shp $shp

But don't work because ogr converts shapefiles of polygons and lines 
into points!

Can anyone tell me how i can select  only shapefiles of points in a 
folder with many shapefiles of many geometry types?

Thanks


More information about the gdal-dev mailing list