[gdal-dev] Geometry column name: Field 'OGR_GEOMETRY' not found in source layer

Even Rouault even.rouault at spatialys.com
Thu Nov 19 10:27:49 PST 2020


Jorge,

> To get only the geometry column from a shapefile, I can do:
> 
> ogrinfo cidade.shp -sql "select OGR_GEOMETRY from cidade"

This is a bit a misnomer: OGR_GEOMETRY is a special keyword to get the 
geometry *type* of a geometry ("POLYGON", "POINT", "LINESTRING"), not the 
geometry itself. For that, for format such as shapefile which don't have a 
named geometry column, you must use the "_OGR_GEOMETRY_" (quoted with double 
quotes as starting with underscore)

> But this column name is not allowed in the -select option on ogr2ogr:
> 
> ogr2ogr -overwrite -skipfailures -update PG:service=estarreja cidade.shp
> -select OGR_GEOMETRY

you can use -sql here as well

Could perhaps make sense to support the special "_ogr_geometry_" field here 
too

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list