-
Notifications
You must be signed in to change notification settings - Fork 207
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
Expose GDALs metadata #950
Conversation
|
||
|
||
@require_gdal_version('2.0') | ||
def extensions(driver): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it will be very useful 👍
Thanks! This indeed looks useful for the driver inference (either for #948 or for doing something similar in geopandas). And I think exposing this is useful in general, as you say, to be able to inspect the actual available drivers. |
Indeed, the state of the Fiona branches is not great right now. I started a merge of maint-1.8 to maint-1.9 but had to pause before I finished. It's the work of an entire afternoon or more and we'll have to tolerate some mess for a while. @rbuffat I think that not fixing GDAL's XML is also an option for us. We can patch GDAL for the wheels we distribute or update to GDAL 3.1.1. Conda-forge can do the same. I'm in favor of this. Let's keep it as minimal as we can. It would be great if Fiona made better UIs possible, but we shouldn't become a framework for UIs or anything like that. |
54b6ffc
to
87bf6cd
Compare
That is a good idea. I removed them and adapted the tests for this part to only run with >= Gdal 3.1.
In #909 the idea was to use the driver create / layer create / open options to filter the respecting options in fiona, as we currently don't have a way to know for an option that is passed to fiona.open for which of these operations the option is meant. But as there were so many XML errors I think this has the chance to open a can of worms. The print driver options are only a byproduct of this. DCAP_VIRTUALIO and the extensions are useful for MemoryFile.
I suspect it is easier to merge maint-1.8 into 1.9 before much more is committed to 1.9. Thus I would suggest waiting with this PR until this is merged. I will also be on staycation for the next 2 weeks, thus there is no hurry. |
@sgillies This PR is ready to be reviewed. Note the changes to travis and appveyor. Gdal 3.1 was missing in travis and the gdal versions removed from travis were still present in appveyor. Also Python 3.9-dev was added to travis as python 3.9 should be released soon. |
@rbuffat this is great work. Developers downstream are looking forward to it and that's always a good sign. About the module name: would "drivers" be more clear than "meta"? |
You are right, the metadata is only about driver capabilities. We have already a drvsupport module, would this also be an option? |
As this functionality could also be useful in rasterio (not that it has to be integrated), it might be good to think for an API that works for both projects. |
@rbuffat I'm going to merge this and then rename the module to fiona.drivers to match the drivers module in rasterio. |
I was too hasty about renaming. We'll need to do that in 2.0 since we still have a |
@sgillies This PR looks a bit messy as it includes some CI/tests updates from maint-1.8, as the current maint-1.9 tests are failing. If you have time it would be nice if you could merge maint-1.8 into maint-1.9. I could create a PR, but then I think the history of the different commits will be lost.
This PR includes the meta module of #909
This module can be used to query metadata items of GDAL https://github.com/rbuffat/Fiona/blob/add_metadata_1_9/fiona/meta.py:
E.g.:
It includes also a method print driver options in a user-friendly form. The advantage compared to the driver page of GDAL's homepage is as this output represents the capabilities of the local GDAL instance whereas GDAL homepages represent the driver capabilities of the latest version of GDAL. GDAL did not include tests for the XML before OSGeo/gdal@f447a31, thus the meta module contains also some GDAL XML fixes.
@jorisvandenbossche In geopandas/geopandas#1609 (comment), you mentioned that this functionality could be used for Geopandas. If you could have a look if the API would be useful for you.