[gdal-dev] GeoJSON: json as string

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Thu Feb 22 12:04:28 PST 2024


Thanks,

So maybe the following SQL with the OGR SQL dialect is then the easiest method for getting the desired result with GDAL:

ogrinfo jsonjson.json -sql "select * EXCEPT (key), cast(key as character) from file" jsonjson.json
...
key (String) = { "start": "2000-01-01", "end": "2023-11-30" }

However, that trick is not exposed to QGIS but maybe there is some other workaround for QGIS.

-Jukka-



Lähettäjä: Even Rouault <even.rouault at spatialys.com>
Lähetetty: torstai 22. helmikuuta 2024 21.32
Vastaanottaja: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>; 'gdal-dev at lists.osgeo.org' (gdal-dev at lists.osgeo.org) <gdal-dev at lists.osgeo.org>
Aihe: Re: [gdal-dev] GeoJSON: json as string

Jukka,

I am looking at a question in gis.stackexchange https://gis.stackexchange.com/questions/476489/geojson-item-considered-a-json-instead-of-a-string. I thought that open option ARRAY_AS_STRING would have some effect on opening the test data, but it does not. Ogrinfo returns String(JSON) with both YES and NO
key (String(JSON)) = { "start": "2000-01-01", "end": "2023-11-30" }
Have I understood something wrong?

{ "start": "2000-01-01", "end": "2023-11-30" } is not a JSON array, but a JSON object/dict, hence the ARRAY_AS_STRING has no effect on that property.

It would only affect something like [ "2000-01-01", "2023-11-30" ]

Even

--

http://www.spatialys.com<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/20240222/de62cde1/attachment.htm>


More information about the gdal-dev mailing list