Re: drvsupport // enabled drivers
Joris Van den Bossche
On Sun, 6 Feb 2022 at 15:17, Magnus Hoffmann <mhoffman@...> wrote:
It means that the GDAL library that fiona uses needs to be build with Xerces as optional dependency enabled. GDAL has many optional dependencies, and so it depends on the exact distribution of GDAL which set of features is supported (the GDAL you are using can be a system package (eg from apt-get, brew), or a conda package, or included in the python wheel, or built from source, or ...).
https://gdal.org/drivers/vector/ has an overview of all vector file formats, and the build requirements for each of them to be supported.
To verify whether your GDAL installation supports a certain file format, I think you can either use `ogrinfo --formats` from the command line (if this utility is available, which is for example the case if you install with conda, but not with a wheel), or use fiona itself:
with fiona.Env() as gdalenv:
supported_drivers = gdalenv.drivers().keys()
I used Fiona & geopandas (and thus gdal) from the anaconda forge channel and had no issue there. Jorisvandenbosche was 80% sure that even the main anaconda main channel would provide the build including (what is even the right term here?) Xerces.
From Sean's answer, I think it could also be a pull request to update drvsupport.py to enable more drivers.
BTW, I just realized that for *reading*, you actually don't have to update fiona.supported_drivers, because by default GDAL will infer the driver from the file.
That way, if you try to read a file format that is not supported by the GDAL installation, you already get a nice error message. I just checked, using a file format that requires xerces and that I can read with fiona installed from conda-forge, when trying to read it with fiona installed from a wheel, I get the following error: "DriverError: 'test.ili' not recognized as a supported file format.".