[gdal-dev] ogrinfo Unable to identify source geometry field with GDAL 3.7 but not 3.3?

Even Rouault even.rouault at spatialys.com
Wed Jul 12 05:57:18 PDT 2023


Gary,

This is very likely due to commit 
https://github.com/OSGeo/gdal/commit/d60e71154c02b84b4c59cd61d3c21eb150f0b42a 
: "when the .csvt indicates WKT and in default KEEP_GEOM_COLUMNS=YES 
mode, prefix the geometry field name with 'geom_'" which was done to 
avoid to have both a regular attribute field and a geometry field with 
the same name, "WKT". Now the geometry column is called "geom_WKT"

3 possible ways of fixing this:

- likely slightly most performant one to switch to using the geometry 
column: change <GeometryField field="WKT" reportSrcColumn="FALSE"> to 
<GeometryField field="geom_WKT" reportSrcColumn="FALSE">

- or change <GeometryField field="WKT" reportSrcColumn="FALSE"> to 
<GeometryField field="WKT" reportSrcColumn="FALSE" encoding="WKT">  to 
ask to use the regular field WKT and interpret it as containing WKT 
geometries

- or add <OpenOptions><OOI 
key="KEEP_GEOM_COLUMNS">NO</OOI></OpenOptions> , for example after the 
<SrcDataSource> element, so that the regular WKT field is not exposed by 
the CSV driver, and thus only a geometry field WKT is exposed

The 2 later ones should likely be compatible with older GDAL versions too

Even


Le 12/07/2023 à 03:35, Gary Turner a écrit :
> As attached. I've removed some bulky documentation from the 
> as-downloaded/supplied zip file.
>
> On 11/07/2023 8:20 pm, Even Rouault wrote:
>> Gary,
>>
>> please provide a VRT and CSV that can reproduce this
>>
>> Even
>>
>> Le 11/07/2023 à 03:55, Gary Turner a écrit :
>>> Hi,
>>> Apologies if this isn't the right place to ask, but I am struggling 
>>> to work out what's going on.
>>> I'm setting up a new windows machine to process address data 
>>> provided by a local agency. I've downloaded new versions of software.
>>> I use ogr2ogr to load csv files via a vrt file into postgres. This 
>>> works fine with my old setup, and has worked with various older 
>>> versions as well.
>>> However with the latest ogr2ogr it fails. ogrinfo --version says 
>>> GDAL 3.7.0, released 2023/05/02
>>>
>>> P:\bin\gdal37>.\ogrinfo.exe C:\temp\addresses.vrt
>>> INFO: Open of `C:\temp\addresses.vrt'
>>>       using driver `OGR_VRT' successful.
>>> 1: addressesERROR 1: Unable to identify source geometry field 'WKT' 
>>> for geometry.
>>>  (None)
>>>
>>> but with an older version GDAL 3.3.1, released 2021/06/28
>>> P:\bin\gdal33>.\ogrinfo.exe C:\temp\addresses.vrt
>>> INFO: Open of `C:\temp\addresses.vrt'
>>>       using driver `OGR_VRT' successful.
>>> 1: addresses (Point)
>>>
>>> I get the same failure with ogr2ogr, but ogrinfo seemed simpler and 
>>> there's a much less complicated command-line.
>>> I've cut this down to a one-field, one-line of csv example that does 
>>> the same thing, if that's useful.
>>>
>>> Is this expected?
>>> Is there an easy work-around, that would work with both versions?
>>> Please let me know if I'm missing something obvious or just being 
>>> dumb, or should  ask elsewhere.
>>>
>>> Thanks
>>> Gary
>>>
>>>
>>> _______________________________________________
>>> gdal-dev mailing list
>>> gdal-dev at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list