[gdal-dev] Geometry column name: Field 'OGR_GEOMETRY' not found in source layer
Jorge Gustavo Rocha
jgr at osgeopt.pt
Thu Nov 19 15:42:59 PST 2020
Hi,
Only now, based on Even's answer, I was able to find the proper
documentation. My fault! I was searching using uppercase and git grep
"_OGR_GEOMETRY_" was returning nothing.
Just an update regarding the documentation:
1) OGR_GEOMETRY is well documented at
https://gdal.org/user/ogr_sql_dialect.html#ogr-geometry
2) "_OGR_GEOMETRY_" is also pretty well documented in the same document,
at https://gdal.org/user/ogr_sql_dialect.html#geometry-field
3) As an alternative for all drivers, GEOMETRY field, used in SQL SQLite
dialect, is well documented at
https://gdal.org/user/sql_sqlite_dialect.html#geometry-field
Regards,
Jorge
Ãs 22:36 de 19/11/20, Jorge Gustavo Rocha escreveu:
> 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