Re: [gdal-dev] GeoJSON: json as string

2024-02-22 Thread Rahkonen Jukka via gdal-dev
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 
Lähetetty: torstai 22. helmikuuta 2024 21.32
Vastaanottaja: Rahkonen Jukka ; 
'gdal-dev@lists.osgeo.org' (gdal-dev@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.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] GeoJSON: json as string

2024-02-22 Thread Even Rouault via gdal-dev

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
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] GeoJSON: json as string

2024-02-22 Thread Rahkonen Jukka via gdal-dev
Hi,

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?
I was testing with GDAL 3.9.0dev (OSGeo4W) on Windows.

-Jukka Rahkonen-

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