TransWikia.com

Extract one geometry type from GML file in GeoPandas

Geographic Information Systems Asked on April 25, 2021

I try to use GML data from Landesvermessung Brandenburg in GeoPandas. It generally works to load files like this:

df = gpd.read_file(r'/vsizip//vsicurl/https://data.geobasis-bb.de/geobasis/daten/3d_gebaeude/lod2_gml/lod2_33379-5805.zip/lod2_33379-5805_geb.gml')

This gives the following warning, which I tend to ignore:

C:DatenAnacondalibsite-packagesgeopandasgeodataframe.py:422: RuntimeWarning: Sequential read of iterator was interrupted. Resetting iterator. This can negatively impact the performance.
  for feature in features_lst:

But one file in the bulk does contain one odd polygon, where linestrings are expected:

df = gpd.read_file(r'/vsizip//vsicurl/https://data.geobasis-bb.de/geobasis/daten/3d_gebaeude/lod2_gml/lod2_33379-5806.zip/lod2_33379-5806_geb.gml')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:DatenAnacondalibsite-packagesgeopandasiofile.py", line 133, in _read_file
    columns = list(features.schema["properties"])
  File "C:DatenAnacondalibsite-packagesfionacollection.py", line 208, in schema
    self._schema = self.session.get_schema()
  File "fiona/ogrext.pyx", line 719, in fiona.ogrext.Session.get_schema
  File "fiona/_geometry.pyx", line 81, in fiona._geometry.normalize_geometry_type_code
fiona.errors.UnsupportedGeometryTypeError: 2147483648

I only want linestrings (MULTILINESTRING Z) and want to ignore other geometry types. Is there a way in GeoPandas?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP