[gdal-dev] GML duplicated FID

Even Rouault even.rouault at spatialys.com
Thu Mar 4 13:36:59 PST 2021


Martin,

You can't probably fix this by using CopyLayer(). But if you use 
GDALVectorTranslate() with the -unsetFid option, that should solve your 
issue.

It would be also good that you file an issue with a minimum reproducer 
file. The GML driver should be ideally be smarter in the way it 
generates FID to avoid this.

Even

Le 04/03/2021 à 22:23, Martin Landa a écrit :
> Hi all,
>
> I have an issue with GML generated by GeoServer. There are features
> with duplicated FID:
>
> ```
> OGRFeature(lucas_view):36
>    gml_id (String) = lucas_view.fid--269ff1b9_177af2abc34_-36e6
>    point_id (Integer) = 45502976
>    nuts0 (String) = CZ
>    POINT (4550000 2976000)
> OGRFeature(lucas_view):36
>    gml_id (String) = lucas_view.fid--269ff1b9_177af2abc34_-36e5
>    point_id (Integer) = 45542918
>    nuts0 (String) = CZ
>    POINT (4554000 2918000)
> ```
>
> This is a reason why converting such data into GPKG (using
> CopyLayer()) fails with:
>
> ```
> ERROR 1: failed to execute insert : UNIQUE constraint failed: layer.fid
> ```
>
> Is there any way to force the GML driver to generate a unique FID
> instead of guessing from  gml_id?
>
> Thanks in advance, Martin
>
-- 
http://www.spatialys.com



More information about the gdal-dev mailing list