Re: KML SimpleData

Sean Gillies

Hi Bonzo,

On Wed, Feb 26, 2020 at 9:41 AM Bonzo <bteluk@...> wrote:
Hi, is it possible to to retrieve SimpleData attributes from a KML document?

I've opened a collection, and tried both KML and KMZ documents - and whilst I can see the "normal" KML attributes - I cannot see the "SimpleData" attributes listed in the feature properties...

I tried to see if I could pass an OGR environment variable... but not sure if I got this right:

with fiona.drivers(LIBKML_USE_SCHEMADATA=True):
  cll ='/vsizip/' + fnSrc + '/doc.kml',mode='r',layer='QFESCurrentIncidents')
  f1 =

I'm using:
Python 2.7.9
Fiona 1.8.13
OS: Linux/Debian 8

Regards, Bonzo.

The modern usage, for fiona 1.8.x, is

import fiona

fiona.drvsupport.supported_drivers["LIBKML"] = "raw"

with fiona.Env(LIBKML_USE_SCHEMADATA=True):
    with"file.kmz", layer="QFESCurrentIncidents") as collection:
        first = next(collection)

However, if you're using the fiona binary wheels installed from the Python package index using pip, you're out of luck. OGR's LIBKML driver, documented at, is not a default format driver and is not included in the binary wheels. This situation might explain why you don't see the SimpleData attributes.

If that's the case, I recommend installing the latest gdal-dev package from DebianGIS (I think this is very likely to entail libkml), and then installing fiona from a non-binary distribution like `pip install -I --no-binary fiona fiona`. Or get the python-fiona Debian package

I'm sorry about the lack of a LIBKML driver, but the binary wheels would be too big if we included every possible format.

Sean Gillies

Join to automatically receive all group messages.