Is it possible to read GML or KML files with Fiona?

3.1k Views Asked by At

I'd like to know if it's possible to read/write GML files (or even KML files) using Fiona.

Fiona documents don't specify what drivers we can use. I read some answers about the drivers that are avalaible but I still haven't figured out the right answer.

These two different sentences print a different number of drivers. The first one doesn't include GML o KML (in fact there are very few formats supported).

print(fiona.supported_drivers)

vs

print('\n'.join(sorted(fiona.drivers().drivers())))

I know how to do it using GDAL/OGR but I want to do the same using Fiona if it's possible.

2

There are 2 best solutions below

5
On

In order to read both KML and GML file formats the OGR binaries distributed with the Fiona implementation you're using need to be compiled against libexpat or Xerces (XML parsers). If these libraries exist in the same installation where the ogr.dll (Windows), ogr.so (Linux) used by Fiona is, then read support is most probably available. If no, then only write support will be available.

4
On

I've just found out that the newest version of Fiona added support to read and write GML files.