Re: [gdal-dev] Converting fid from GeoJSON into GeoPackage

2021-06-21 Thread Rahkonen Jukka (MML)
Thanks,

I believe this resolves my previous problem by the same. The indirect_sqlite 
dialect is not so handy in this case because it wants do download the whole 
collection from OAPIF.

So because OAPIF is sending data as GeoJSON there is no name for the FID column 
and it is obligatory to use ogr2ogr with "-preserve_fid" if the aim is to 
preserve FID.  I will see if there is something to improve with this in the 
documentation. I had some trouble with joining  edited data with the original 
because 15 million feature ids changed into counting numbers.

-Jukka-

Lähettäjä: Even Rouault 
Lähetetty: maanantai 21. kesäkuuta 2021 18.09
Vastaanottaja: Rahkonen Jukka (MML) ; 
'gdal-dev@lists.osgeo.org' 
Aihe: Re: [gdal-dev] Converting fid from GeoJSON into GeoPackage


Jukka,

Automatic FID preservation requires that the source layer reports a non-empty 
column name for the FID column, which isn't the case of the GeoJSON driver. 
Mostly only SQL-based drivers will report a non-empty FID column name.

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

Take this GeoJSON

{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"id":12425552,
"properties":
{
},
"geometry": {
"type": "Point",
"coordinates": [26.30578223, 60.26170791]
}
}]
}

Ogrinfo knows the fid
OGRFeature(one_feature):12425552

Convert into a new GeoPackage and the native fid is lost
ogr2ogr -f gpkg one_feature.gpkg one_feature.json
OGRFeature(one_feature):1

Running the command with "-preserve_fid" keeps the native fid but according to 
ogr2ogr documentation https://gdal.org/programs/ogr2ogr.html that should not be 
needed:

"Use the FID of the source features instead of letting the output driver 
automatically assign a new one (for formats that require a FID). If not in 
append mode, this behavior is the default if the output driver has a FID layer 
creation option, in which case the name of the source FID column will be used 
and source feature IDs will be attempted to be preserved."

Is the error in the documentation or in the GeoJSON-GeoPackage conversion?

-Jukka Rahkonen-






___

gdal-dev mailing list

gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>

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

--

http://www.spatialys.com

My software is free, but my time generally not.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Converting fid from GeoJSON into GeoPackage

2021-06-21 Thread Even Rouault

Jukka,

Automatic FID preservation requires that the source layer reports a 
non-empty column name for the FID column, which isn't the case of the 
GeoJSON driver. Mostly only SQL-based drivers will report a non-empty 
FID column name.


Even

Le 21/06/2021 à 17:04, Rahkonen Jukka (MML) a écrit :


Hi,

Take this GeoJSON

{

"type": "FeatureCollection",

"features": [{

"type": "Feature",

"id":12425552,

"properties":

{

},

"geometry": {

"type": "Point",

"coordinates": [26.30578223, 60.26170791]

}

}]

}

Ogrinfo knows the fid

OGRFeature(one_feature):12425552

Convert into a new GeoPackage and the native fid is lost

ogr2ogr -f gpkg one_feature.gpkg one_feature.json

OGRFeature(one_feature):1

Running the command with “-preserve_fid” keeps the native fid but 
according to ogr2ogr documentation 
https://gdal.org/programs/ogr2ogr.html 
 that should not be needed:


“Use the FID of the source features instead of letting the output 
driver automatically assign a new one (for formats that require a 
FID). If not in append mode, this behavior is the default if the 
output driver has a FID layer creation option, in which case the name 
of the source FID column will be used and source feature IDs will be 
attempted to be preserved.”


Is the error in the documentation or in the GeoJSON-GeoPackage conversion?

-Jukka Rahkonen-


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


--
http://www.spatialys.com
My software is free, but my time generally not.

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


[gdal-dev] Converting fid from GeoJSON into GeoPackage

2021-06-21 Thread Rahkonen Jukka (MML)
Hi,

Take this GeoJSON

{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"id":12425552,
"properties":
{
},
"geometry": {
"type": "Point",
"coordinates": [26.30578223, 60.26170791]
}
}]
}

Ogrinfo knows the fid
OGRFeature(one_feature):12425552

Convert into a new GeoPackage and the native fid is lost
ogr2ogr -f gpkg one_feature.gpkg one_feature.json
OGRFeature(one_feature):1

Running the command with "-preserve_fid" keeps the native fid but according to 
ogr2ogr documentation https://gdal.org/programs/ogr2ogr.html that should not be 
needed:

"Use the FID of the source features instead of letting the output driver 
automatically assign a new one (for formats that require a FID). If not in 
append mode, this behavior is the default if the output driver has a FID layer 
creation option, in which case the name of the source FID column will be used 
and source feature IDs will be attempted to be preserved."

Is the error in the documentation or in the GeoJSON-GeoPackage conversion?

-Jukka Rahkonen-


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