-
Notifications
You must be signed in to change notification settings - Fork 18
Polygons with holes are now rendered correctly #513
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
Polygons with holes are now rendered correctly #513
Conversation
|
Hey @rushin682 and @quentinblampey, could you verify that your data works with this branch? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #513 +/- ##
==========================================
+ Coverage 84.80% 84.84% +0.03%
==========================================
Files 8 8
Lines 2146 2158 +12
==========================================
+ Hits 1820 1831 +11
- Misses 326 327 +1
🚀 New features to boost your workflow:
|
|
Hi @timtreis, thanks for the fix! |
|
Actually I had some time to test it right now @timtreis, and, while it worked well on simple polygons, it didn't work on more complex polygons. Here is an example: 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()
While GeoPandas shows:
Do you really need to convert it to a multipolygon? I think the inner geopandas function |
|
I have a bit of preemptive PTSD for making all transformations/parameters etc work if we'd swap to a new plotting function. We'd also loose control over the internals of it. Let me dig into that issue, I really thought it would be solved. The logger also correctly notices that there is a hole, it just doesn't plot it for some reason. I'm confused as to why this polygon is different from your previous example |
|
Yes, I'll also try many different things to understand what's different from the other polygon, but I couldn't find a solution yet... |


No description provided.