Re: drvsupport // enabled drivers

Joris Van den Bossche

On Sun, 6 Feb 2022 at 15:17, Magnus Hoffmann <mhoffman@...> wrote:
Hi Sean,

thanks for the reply. Makes more sense to me now. I do have a follow up question: What exactly does dependence on Xerces means in practice and where can i verify the build i'm using? I'm quite unfamiliar with wheels and still working through the gdal documentation.

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 ...). 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:

import fiona

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.
Actually, i come from geopandas, where i was asking sort of the same question. I'm working on an addition to the documentation there. At least for me the route to Fiona was via geopandas. I will work on a pull request here once i'm done. I reckon pull request should be regarding an update to the documentation?

From Sean's answer, I think it could also be a pull request to update 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.".



Join to automatically receive all group messages.