Date
1 - 3 of 3
KML SimpleData
Bonzo
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 = fiona.open('/vsizip/' + fnSrc + '/doc.kml',mode='r',layer='QFESCurrentIncidents') f1 = cll.next() f1['properties'].keys() I'm using: Python 2.7.9 Fiona 1.8.13 OS: Linux/Debian 8 Regards, Bonzo.
|
|
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? 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 fiona.open("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 https://gdal.org/drivers/vector/libkml.html, 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 https://packages.debian.org/search?searchon=names&keywords=python-fiona. 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
|
|
Bonzo
Thanks Sean, much appreciated! (thanks for the coding correction too - I was getting deprecation errors with mine!)
Regards, Bonzo.
|
|