4

I have a GeoJSON file of points which I am editing using QGIS 2.16.1.

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },

"features": [
{ "type": "Feature", "id": 1, "properties": { "geo_code": "E02002536", "avslope": 0.710642 }, "geometry": { "type": "Point", "coordinates": [ -1.295758646546615, 54.610678649992742 ] } },
{ "type": "Feature", "id": 2, "properties": { "geo_code": "E02002537", "avslope": 0.614510 }, "geometry": { "type": "Point", "coordinates": [ -1.277248239209249, 54.611301122046676 ] } },

After eding the file and using the Save As feature the id field has been removed

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },

"features": [
{ "type": "Feature", "properties": { "geo_code": "E02002536", "avslope": 0.710642 }, "geometry": { "type": "Point", "coordinates": [ -1.295758646546615, 54.610678649992742 ] } },
{ "type": "Feature", "properties": { "geo_code": "E02002537", "avslope": 0.614510 }, "geometry": { "type": "Point", "coordinates": [ -1.277248239209249, 54.611301122046676 ] } },

I need this field, and it is part of the GeoJSON standard. Is it possible to save the file and include the id field. I have tried using the Attibute editor but the changes are made within properties not at the top level.

  • what version of gdal are you using and which OS? (Help > QGIS, or use gdal-config --version from command line). I can reproduce this on 2.16.1 with gdal 1.11.2 on Ubuntu. – Steven Kay Sep 26 '16 at 19:19
  • I can reproduce it (ie. if I open a GeoJSON with an id field, then do nothing apart from exporting it in GeoJSON, there is no more id field) using QGIS 2.16.1 (ubuntu 16.04.1 / >>> osgeo.__version__ '1.11.3' in QGIS). – mgc Sep 26 '16 at 20:07
  • It is QGIS 2.16.1 on Windows 10 64 bit – falcs Sep 27 '16 at 8:37
  • 1
    Same happens with QGIS 3.4.4. – user30184 Jun 28 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.