[gdal-dev] Geometry column name: Field 'OGR_GEOMETRY' not found in source layer
Jorge Gustavo Rocha
jgr at osgeopt.pt
Thu Nov 19 14:36:05 PST 2020
Hi Even,
Thanks for the feedback. The difference you mentioned is well understood
with the example:
-sql 'select OGR_GEOMETRY, "_OGR_GEOMETRY_" from layer'
I get exactly what is expected from both fields:
POLYGON | POLYGON(...)
POLYGON | POLYGON(...)
It would be nice to allow "_OGR_GEOMETRY_" in ogr2ogr -select, but the
usage of -sql works.
To make the usage of this "_OGR_GEOMETRY_" more clear, may I add an
example to https://gdal.org/programs/ogrinfo.html?
I think this is not well documented. The only reference I used [1] is
not accurate anymore. It says:
"the special field names âOGR_GEOMETRYâ and âOGR_STYLEâ will be
interpreted to refer to the geometry and style values of a feature".
Regards,
Jorge
[1]
https://gdal.org/development/rfc/rfc29_desired_fields.html?highlight=ogr_geometry
Ãs 18:27 de 19/11/20, Even Rouault escreveu:
> 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
>
--
OSGeo Portugal
NIF: 509588190
email: geral at osgeopt.pt
https://www.osgeopt.pt/
Próximo evento: SASIG 2017, 20 a 22 de novembro, Porto
Mais informações: http://osgeopt.pt/sasig2017/
More information about the gdal-dev
mailing list