Toblerity / Fiona

Fiona reads and writes geographic data files
https://fiona.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.14k stars 202 forks source link

Fails to read schema from GML layer with CompoundCurve geometry #1311

Closed Bjoern-Rapp closed 6 months ago

Bjoern-Rapp commented 10 months ago

Fiona can read curved geometries, and give a linear approximations, just fine, from what i can read from #617. But, when I (or Geopandas) try to read the schema from a layer with "CompoundCurve" geometries, Fiona fails with "fiona.errors.UnsupportedGeometryTypeError: 9". If all the geometries are converted to a linestring, the schema should probably reflect that.

filpath = "/vsizip//vsicurl/https://nedlasting.geonorge.no/geonorge/Basisdata/Kommuner2022/GML/Basisdata_0000_Norge_3035_Kommuner2022_GML.zip"
with fiona.open(filpath , driver="GML", layer="Fylkesgrense") as src:
    print(src.schema["geometry"])

Traceback (most recent call last):
  File ".\Lib\site-packages\IPython\core\interactiveshell.py", line 3526, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-21-4a8d005e6542>", line 3, in <module>
    print(src.schema["geometry"])
          ^^^^^^^^^^
  File ".\Lib\site-packages\fiona\collection.py", line 416, in meta
    "schema": self.schema,
              ^^^^^^^^^^^
  File ".\Lib\site-packages\fiona\collection.py", line 293, in schema
    self._schema = self.session.get_schema()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "fiona\ogrext.pyx", line 828, in fiona.ogrext.Session.get_schema
  File "fiona\_geometry.pyx", line 60, in fiona._geometry.normalize_geometry_type_code
fiona.errors.UnsupportedGeometryTypeError: 9

Fiona and GDAL version and provenance

fiona 1.9.4.post1 installed with poetry gdal 3.6.4

sgillies commented 10 months ago

@Bjoern-Rapp thanks for the report! We're testing curves, but not very rigorously https://github.com/Toblerity/Fiona/blob/maint-1.9/tests/test_curve_geometries.py#L12. I assume the CSV case is slipping by where GML does not.

sgillies commented 6 months ago

@Bjoern-Rapp the fix is released in 1.9.6 today.