geopandas / pyogrio

Vectorized vector I/O using OGR
https://pyogrio.readthedocs.io
MIT License
272 stars 22 forks source link

ENH: Add support for detecting write drivers using GDAL #270

Closed brendan-ward closed 1 year ago

brendan-ward commented 1 year ago

Resolves #220 Supersedes #268

This adds support to use GDAL directly to detect supported write drivers based on a path, instead of using the hard-coded list we had previously.

This moves the detect_driver function to core; we may want to expose this as part of the public API for use in GeoPandas but I did not yet do so (let me know if this is a good idea).

As part of this, I had to rearrange a few things that are not part of the public API:

theroggy commented 1 year ago

@brendan-ward sorry for the late review...

Looks nice!

I only try to support a handful of drivers, so not really important for me, but I'm doing some driver-specific stuff when writing in geofileops, so probably other people will do so as well? The detect_driver API is also pretty straightforward, so I also think it won't be difficult to keep it stable. Just not sure if it wouldn't be better to make it explicit in the function name that it will only return writable drivers? Conclusion: exposing it as a public function sounds like a good idea to me, possibly with a slightly different name.

Probably it will be a good idea to revisit DRIVERS vs DRIVERS_EXT vs ALL_EXTS once upon a time now they are all only supporting the tests... but that's definitely not something for this PR.