cleder / pygeoif

Basic implementation of the __geo_interface__ 🌐️
https://pygeoif.readthedocs.io
67 stars 27 forks source link

from_wkt does not handle nested GeometryCollections correctly #216

Open cleder opened 8 months ago

cleder commented 8 months ago

GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0), MULTIPOINT (0 0, 1 1, 1 2, 2 2)), LINESTRING (0 0, 3 1)), POLYGON ((0 0, 1 1, 1 0, 0 0))) cannot be parsed sucessfully

cleder commented 2 months ago

I think that from_wkt can be implemented more efficient with the switch statement. Have a look at Raymond Hettingers Structural Pattern Matching in the Real World slides

cleder commented 2 months ago

Because structural patter matching is implemented in python 3.10+ any implementation on top of this should be implemented in a separate module, so we can fall back on the old implementation in case of import or syntax errors on import time.