[gdal-dev] ogr2ogr and RFC41

Martin Landa landa.martin at gmail.com
Thu Oct 23 13:49:17 PDT 2014


Hi,

2014-06-11 23:45 GMT+02:00 Even Rouault <even.rouault at mines-paris.org>:

> Yes, by default it will transfer all source geometry fields into the target
> layer, if it supports multiple geometry fields. If you want only a subset of
> source geometry fields, you can write a SQL clause " SELECT geomfield1,
> geomfield2, other_attr FROM your_layer"

it's not work for me, eg.

$ ogr2ogr -f GPKG -sql "select originalnihranice from staty"
staty.gpkg PG:dbname=vfr_uksh_10_cr  -overwrite

gives

$ ogrinfo staty.gpkg sql_statement | grep Geometry

Geometry: Unknown (any)
Geometry Column = geom

I found `-select` option which seems to work:

$ ogr2ogr -f GPKG -select originalnihranice staty.gpkg
PG:dbname=vfr_uksh_10_cr staty -overwrite

$ ogrinfo staty.gpkg staty | grep Geometry

Geometry: Multi Polygon <-- OK
Geometry Column = geom

But it's still no usable, having attribute table with 10+ attributes I
need to write something like

--select geom2,attr1,attr2,...attr10

Would make sense to you to add a new option

--except geom1

or

--select !geom1

?

Thanks, Martin


-- 
Martin Landa * http://geo.fsv.cvut.cz/gwiki/Landa


More information about the gdal-dev mailing list