Skip to content

inverted inner polygons in MultiPolygons are not rendered correctly #516

Description

@timtreis

As pointed out in #513 (comment), MultiPolygons still cause issues.

MRE from @quentinblampey

from shapely import Polygon
from geopandas import GeoDataFrame
from spatialdata import SpatialData
from spatialdata.models import ShapesModel
import spatialdata_plot

ext = [
    (7.866043666934409, 32.80184055229537),
    (19.016191271980425, 203.48380872801957),
    (75.90086964475744, 236.02570144190528),
    (229.48380872801957, 235.98380872801957),
    (235.98380872801957, 5.516191271980426),
    (197.42585593903195, 6.144892860751103),
    (116.5, 96.4575926540027),
    (55.65582863082729, 12.531294107459374),
    (7.866043666934409, 32.80184055229537),
]

interior = [
    (160.12353079731844, 173.21221665537414),
    (181.80184055229537, 159.13395633306558),
    (198.86604366693442, 179.80184055229537),
    (178.19815944770465, 198.86604366693442),
    (160.12353079731844, 173.21221665537414),
]
polygon = Polygon(ext, [interior])

geo_df = GeoDataFrame(geometry=[polygon])

sdata = SpatialData(shapes={"test": ShapesModel.parse(geo_df)})

sdata.pl.render_shapes("test").pl.show()

Apparently, polygons have an inner orientation and our code was naively assuming it's always the same

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions