OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.81k stars 2.52k forks source link

GeoJSON file is unreadable depending on order of fields #1537

Closed danshapero closed 5 years ago

danshapero commented 5 years ago

Expected behavior and actual behavior.

I expected to be able to open this GeoJSON file but I get an error message:

FAILURE:
Unable to open datasource `meshes/larsen/larsen_inflow.geojson' with the following drivers.

followed by a long list that includes GeoJSON. I am able to open this modified version which consists of a trivial reordering of the fields, putting "type": "LineString" before the coordinates rather than after.

I asked this question on the GIS stack exchange about the problem. Another commenter found that the bug is suppressed if the "crs" field is moved too. A different commenter found that the bug doesn't appear when reading the file directly from the URL.

Steps to reproduce the problem.

I have found the bug using gdal-2.3.2, 2.4.0, 2.4.1, and 3.0.

# fails
git clone https://github.com/icepack/icepack-data && cd icepack-data
ogrinfo meshes/larsen/larsen_inflow.geojson

# succeeds
git checkout --track origin/larsen-inflow
ogrinfo meshes/larsen/larsen_inflow.geojson

But I also tested it on gdal-2.1.3 and everything works fine.

Operating system

Both Arch Linux and Debian buster, the latter through docker.

GDAL version and provenance

gdal-2.3.2 installed via pacman on Arch Linux; gdal-2.4.0 installed via apt-get on Debian buster; and gdal-2.4.1, 3.0, and 2.1.3 installed from source on Debian buster.

jratike80 commented 5 years ago

Operating system does not make difference, I can see the same behavior on Windows with the GDAL 3.1.0dev binaries from gisinternals.com.

NiklasDallmann commented 3 years ago

I cannot view the linked files because they don't exist anymore but I believe this bug still exists. I need to process files containing isochrones which were generated by Open Route Service. Depending on where inside the file "type": "FeatureCollection" occurs, opening the file through GDAL either fails or succeeds.

Files to reproduce: Succeeds Fails

Operating System

Manjaro Linux

GDAL versions