[gdal-dev] Problem with OAPIF and numeric id in the data

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Mon Jun 21 09:18:53 PDT 2021


Thanks,

I can get a copy of the native OAPIF FID into a normal attribute with

ogrinfo OAPIF:https://beta-paikkatieto.maanmittauslaitos.fi/kiinteisto-avoin/features/v1/ -dialect sqlite -sql "select rowid, * from RajamerkinSijaintitiedot limit 10" --debug on

OGRFeature(SELECT):9
  rowid (Integer) = 12425588

A bit strange message at the end of the debug info but I guess that for some reason the features are read twice:
SQLite: 20 features read on layer 'SELECT'.
OGR: Unloading VirtualOGR module

I know now well enough how I can get and store the native fids from OAPIF service with GDAL command line tools. However, QGIS seems to drop the native fids and generate new ones but that's another problem to learn to circumvent.

-Jukka-

Lähettäjä: Even Rouault <even.rouault at spatialys.com>
Lähetetty: maanantai 21. kesäkuuta 2021 17.50
Vastaanottaja: Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi>; 'gdal-dev at lists.osgeo.org' <gdal-dev at lists.osgeo.org>
Aihe: Re: [gdal-dev] Problem with OAPIF and numeric id in the data


Jukka,

https://github.com/OSGeo/gdal/commit/36aa932aba3775f1e6ec825ba39c633442ffa640 should help

Even
Le 21/06/2021 à 16:01, Rahkonen Jukka (MML) a écrit :
Hi,

With this request

ogrinfo OAPIF:https://beta-paikkatieto.maanmittauslaitos.fi/kiinteisto-avoin/features/v1/ -dialect sqlite -sql "select * from RajamerkinSijaintitiedot limit 10" --debug on

ogrinfo does not use the "id" member as feature id nor does is report it as an attribute. Id exists in the data in this format
{"type":"FeatureCollection","features":[{"type":"Feature","id":12425552,"properties":{
as can be checked with https://beta-paikkatieto.maanmittauslaitos.fi/kiinteisto-avoin/features/v1/collections/RajamerkinSijaintitiedot/items?f=json&limit=10

The service that is used as reference in https://gdal.org/drivers/vector/oapif.html is having the id as string
"type" : "Feature","id" : "DENW42AL1000NscuFL",

and in this case ogrinfo does not use "id" ad fid either but at least reads it as a normal attribute
ogrinfo -al OAPIF:https://www.ldproxy.nrw.de/rest/services/kataster flurstueck --debug on
...
OGRFeature(flurstueck):110
  id (String) = DENW42AL1000NtLGFL


I managed to get the "id" used as fid when converting data from the service at maanmittauslaitos.fi into geopackage by using -preserve_fid but for some reason today even that does not work for me.

-Jukka Rahkonen-




_______________________________________________

gdal-dev mailing list

gdal-dev at lists.osgeo.org<mailto: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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210621/dd6989b9/attachment.html>


More information about the gdal-dev mailing list