-
Notifications
You must be signed in to change notification settings - Fork 557
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
Add .geoms
to all shapes
#1881
Comments
Hi @adishavit , thanks for your suggestion. Personally I think it is incorrect conceptually to give a simple geometry a “.geoms” attribute. |
Many Shapely operation have polymorphic return types: that is, the type of the return value may be different depending on the input (buffer, union, intersection etc.) and may also be different from the input type ofc. The fact that such functions (e.g. Adding My own Nevertheless, this is an opt-in feature, so if one does not want to use it, they are welcome to avoid it. |
I can see your argument and I tend towards approving this change. If your team uses this frequently then it probably has more use cases too. But I'd like to hear @sgillies 's opinion about this as well. |
Just for some context, geopandas.GeoSeries has a |
@adishavit @caspervdw In the past I've been interested in eliminating the distinction between a Polygon and a MultiPolygon with one part, but I couldn't find anybody else who cared. I suspect some algorithms are much more efficient if you know that the input is a single valid polygon and not several polygons. But I don't see harm in generalizing |
Ok let’s do it! @adishavit do you have the time to do the PR? |
Also looking forward to this! I don't like how methods like An alternative would be to add a constructor for Ideally, I would prefer that |
Multi part geometries have a
.geoms
sequence of all the parts.I suggest adding a
.geoms
to the single part geometries too.It will return just the shape itself but make usability much more consistent without the need to differentiate.
Today, I actually have a wrapper to allow mw to work consistently.
It should be almost trivial to add, be efficient (no copies) and would not break existing code.
WDYT?
The text was updated successfully, but these errors were encountered: