Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Bjoern-Rapp opened this issue Nov 7, 2023 · 2 comments
Closed

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

Bjoern-Rapp opened this issue Nov 7, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@Bjoern-Rapp
Copy link

Bjoern-Rapp commented Nov 7, 2023

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

@Bjoern-Rapp Bjoern-Rapp changed the title Fails to read GML layer with CompoundCurve geometry Fail to read GML layer with CompoundCurve geometry Nov 7, 2023
@Bjoern-Rapp Bjoern-Rapp changed the title Fail to read GML layer with CompoundCurve geometry Fails to read schema from GML layer with CompoundCurve geometry Nov 7, 2023
@sgillies sgillies self-assigned this Nov 7, 2023
@sgillies sgillies added the bug label Nov 7, 2023
@sgillies sgillies added this to the 1.9.6 milestone Nov 7, 2023
@sgillies
Copy link
Member

sgillies commented Nov 7, 2023

@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 pushed a commit that referenced this issue Nov 8, 2023
Adds a small multi-curve GML file and Makefile, Dockerfile for
local testing.
sgillies pushed a commit that referenced this issue Nov 8, 2023
@sgillies
Copy link
Member

sgillies commented Mar 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants