Re: [gdal-dev] GML duplicated FID

2021-03-04 Thread Martin Landa
Hi,

čt 4. 3. 2021 v 22:48 odesílatel Even Rouault
 napsal:
> > [1] http://geo102.fsv.cvut.cz/~landa/tmp/data_CZ.gml.7z
>
> yes please. If you can strip it down to just a few features that can
> reproduce the issue, that's even better.

I am not sure what is the reason why GML driver behaves like that.
GDAL generates unique FID even when gml_id is duplicated...

```
OGRFeature(lucas_view):0
  gml_id (String) = lucas_view.fid--269ff1b9_177af2abc34_-36ed
  point_id (Integer) = 45502976
  nuts0 (String) = CZ

OGRFeature(lucas_view):1
  gml_id (String) = lucas_view.fid--269ff1b9_177af2abc34_-36ed
  point_id (Integer) = 45542918
  nuts0 (String) = CZ
```

Issue created anyway [1].

Ma

[1] https://github.com/OSGeo/gdal/issues/3532

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] GML duplicated FID

2021-03-04 Thread Even Rouault
In the below example, the gml_id are not duplicated if you look 
cloosely. The duplication of the OGR FID is a pure GDAL behaviour in the 
way it tries to derive a FID from gml_id. So Geoserver behaves just fine 
here.


Le 04/03/2021 à 23:02, jratike80 a écrit :

Hi,

It would be interesting to know how you manage to generate duplicate fids
with Geoserver but perhaps it is better to discuss about that in
geoserver-users.

-Jukka Rahkonen-


Martin Landa wrote

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 (455 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

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
gdal-dev mailing list
gdal-dev@.osgeo
https://lists.osgeo.org/mailman/listinfo/gdal-dev





--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
http://www.spatialys.com

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] GML duplicated FID

2021-03-04 Thread Martin Landa
Hi,

čt 4. 3. 2021 v 23:03 odesílatel jratike80
 napsal:
> It would be interesting to know how you manage to generate duplicate fids
> with Geoserver but perhaps it is better to discuss about that in
> geoserver-users.

to my understanding, the duplicate FID are generated by GDAL not by
GeoServer. See

```
> OGRFeature(lucas_view):36
>gml_id (String) = lucas_view.fid--269ff1b9_177af2abc34_-36e6
>point_id (Integer) = 45502976
>nuts0 (String) = CZ
>POINT (455 2976000)
> OGRFeature(lucas_view):36
>gml_id (String) = lucas_view.fid--269ff1b9_177af2abc34_-36e5
>point_id (Integer) = 45542918
>nuts0 (String) = CZ
>POINT (4554000 2918000)
```

In both cases gml_id ends with `-36e5` and FID generated by GDAL is 36.

Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] GML duplicated FID

2021-03-04 Thread Martin Landa
Hi,

čt 4. 3. 2021 v 22:42 odesílatel Martin Landa  napsal:
> > You can't probably fix this by using CopyLayer(). But if you use
> > GDALVectorTranslate() with the -unsetFid option, that should solve your
> > issue.
>
> Thanks for a hint!

```
gdal.VectorTranslate("file.gpkg", "file.gml")
```

works like a charm! Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] GML duplicated FID

2021-03-04 Thread jratike80
Hi,

It would be interesting to know how you manage to generate duplicate fids
with Geoserver but perhaps it is better to discuss about that in
geoserver-users.

-Jukka Rahkonen-


Martin Landa wrote
> 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 (455 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
> 
> -- 
> Martin Landa
> http://geo.fsv.cvut.cz/gwiki/Landa
> http://gismentors.cz/mentors/landa
> ___
> gdal-dev mailing list

> gdal-dev@.osgeo

> https://lists.osgeo.org/mailman/listinfo/gdal-dev





--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] GML duplicated FID

2021-03-04 Thread Even Rouault




Here it is [1]. Should I report it as a Github issue?

Martin

[1] http://geo102.fsv.cvut.cz/~landa/tmp/data_CZ.gml.7z


yes please. If you can strip it down to just a few features that can 
reproduce the issue, that's even better.


--

http://www.spatialys.com

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] GML duplicated FID

2021-03-04 Thread Martin Landa
Dear Even,

čt 4. 3. 2021 v 22:37 odesílatel Even Rouault
 napsal:

first of all, thanks for quick reply!

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

Thanks for a hint!

> 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.

Here it is [1]. Should I report it as a Github issue?

Martin

[1] http://geo102.fsv.cvut.cz/~landa/tmp/data_CZ.gml.7z

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] GML duplicated FID

2021-03-04 Thread Even Rouault

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 (455 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

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev