Re: drvsupport // enabled drivers


Sean Gillies
 

Hi RadMagnus,

On Thu, Feb 3, 2022 at 3:47 PM Magnus Hoffmann <mhoffman@...> wrote:

Hey all,

i have been trying to open NAS - ALKIS files for a while now. It's been a headache and i ended up working with gdal directly, which is fine for the moment. But not as neat and nimble as could be. Jorisvandenbosche from geopandas (god bless him) drew my attention to master/fiona/drvsupport.py (https://github.com/Toblerity/Fiona/blob/master/fiona/drvsupport.py#L94). That shows NAS - ALKIS is in fact a supported file format (makes sense as OGR offers a driver). However it is commented out, so working with geopandas directly or "vanilla" Fiona, NAS is not supported.

Jorisvandenbosche had the idea to change the supported drivers on runtime like so & it works like charm:

import fiona
fiona.supported_drivers["NAS"] = "raw"

geopandas.read_file(..., driver="NAS")

The ALKIS community is scratching their head how to work with this file format in Python. The answer is beautifully simple but a bit hidden for the average ALKIS/Python user. So my questions are:

1. Why are some of the supported drivers (assuming they are supported based on the filename) commented out making them unavailable.

Early in the development of the project we were being cautious about which formats to support. I wanted to focus on the fiona API instead of answering user questions about formats that I didn't use or understand. Some OGR drivers were clearly unmaintained at the time. And quality and/or completeness varied. OGR's GML support has always seemed quite limited. So at the time, formats that weren't built in were disabled, and some built in formats that were not excellent were also disabled.

2. Can we get this info, how to change it on runtime out in the open? Maybe an addition to the Fiona documentation Or even open an issue/pull request to have it available in "vanilla" Fiona?

Now that the Fiona project is more mature and OGR is removing unmaintained format drivers, we can probably enable more drivers. However, because of the dependence on Xerces, I don't think we would ever include this driver in the fiona wheels that are published to PyPI.

A pull request would be welcome.

Yours,

--
Sean Gillies

Join main@fiona.groups.io to automatically receive all group messages.