0

I'm having a problem reading a GeoJSON file in QGIS. The file can be found at this git repository. When I try to load in the file, I get an error message that it's invalid, but the "Reason:" field is empty. However, when I trivially reorder the fields under "geometry" to put

"type": "LineString"

at the start instead of at the end, QGIS can load it. The fixed version of the GeoJSON file is here. As far as I understand, the ordering of keys in a JSON object is completely immaterial, so I don't see why this change should make a difference. I'm able to read both files just fine in the web version of ArcGIS. Is this a problem with the GeoJSON file or have I found a bug in QGIS?

  • For original file, not able to reproduce using QGIS 3.6.2-Noosa on Ubuntu 18.04 64 bits as it works. => Version of QGIS you are using? – ThomasG77 May 13 at 22:35
  • I'm using 3.6 but I've had this going back to older version, I'll try upgrading to 3.6.2. – korrok May 13 at 22:42
  • @user2856 please make that an answer rather than comment – Mapperz May 14 at 2:06
  • Yes @user2856 please make that an answer and I'll accept. Thanks to your suggestion I've been able to reproduce the problem with gdal-2.3.2, 2.4.1, and 3.0, but I have no problem on gdal-2.1.4. – korrok May 14 at 2:15
  • The problem is somehow related to crs. If I remove the whole crs member then GDAL 2.5-dev reads the json file without other edits. – user30184 May 14 at 9:49
4

It's not QGIS. It's the underlying GDAL library (I'm running 2.4).

Your 1st geojson fails when read from a file saved to the filesystem.

ogrinfo filepath/master/larsen_inflow.geojson # Fail
ogrinfo filepath/larsen-inflow branch/larsen_inflow.geojson  # Success

However... the 1st geojson can be opened fine when read from a url

ogrinfo https://<master>/larsen_inflow.geojson # Success!?!?
ogrinfo https://<larsen-inflow branch>/larsen_inflow.geojson  # Success

Smells like a bug to me. Suggest you ask on GDAL-DEV mailing list or post an issue (search for dupes first).

Edit: it's a bug and has been resolved.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.