-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
layer kwarg behavior in 1.9 vs 1.10 #1455
Comments
@perrygeo the |
I get the same behavior with a FeatureCollection: feat = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {}, "geometry": null}]}'
with fiona.open(feat, "r", layer=0) as f:
assert len(f) == 1 which runs in 1.9.6 but gives this traceback in 1.10.1
The workaround is to |
Given a well-formed GeoJSON file,
The code at https://github.com/Toblerity/Fiona/blob/main/fiona/ogrext.pyx#L880-L887 isn't substantially different from the code in 1.9.6, so I suspect that the most recent version of GDAL returns NULL when it doesn't find any useful feature in the GeoJSON file. |
In my case the string is GeoJSON, not a file path. Arguably opening a geojson string as a data source isn't even a good idea, but it used to work so it became part of rasterstats public API. Hyrum's law strikes again! It could very well be GDAL changes. Looks like the Fiona 1.9.6 wheel was built with GDAL 3.6.4, and the 1.10.1 wheel was built with GDAL 3.9.2. So the change happened somewhere in there. In any case, it doesn't seem like a fiona issue so I'll close here. We have two workarounds - load it into python dicts, or build against an older GDAL. Thanks @sgillies ! |
Expected behavior and actual behavior.
In fiona 1.9.6, the following code was valid
but fails with fiona 1.10.1 with something like
I didn't see anything obvious in the CHANGES. Is there a move away from the OGR convention of layer 0 as the default?
Note that opening GeoJSON strings work fine if you omit the
layer
kwarg.Steps to reproduce the problem.
see above
Operating system
Linux x86_64
Fiona and GDAL version and provenance
Fiona 1.10.1 binary wheel from pypi
The text was updated successfully, but these errors were encountered: