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

ENH: add shared_paths method #3215

Merged
merged 13 commits into from
May 18, 2024

Conversation

martinfleis
Copy link
Member

xref #2010

One thing I was considering here was if to explode the collection to two GeoSeries but if a user does not care about the direction then the original GeometryCollection that comes from GEOS is probably better and they can explode it later if needed.

Comment on lines 176 to 207
self.l5 = LineString([(100, 0), (0, 0), (0, 100)])
self.l6 = LineString([(5, 5), (5, 100), (100, 5)])
self.g12 = GeoSeries([self.l5])
self.g13 = GeoSeries([self.l6])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplication of the lines right above I just noticed.

Comment on lines 4244 to 4246
align : bool (default True)
If True, automatically aligns GeoSeries based on their indices. If False,
the order of elements is preserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given recent discussions, this should be updated (removing the keyword)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, all methods that take array of geometries have the align keyword. I have just updated it to default to None as we did elsewhere.

The solution with raise is used for other, non-geo args, like distance or tolerance.

Not the best solution but consistent within the limits.

@jorisvandenbossche
Copy link
Member

Small idea for the docstring: should we mention how you can get the element out of the collection? For example, how to get a GeoSeries of multilinstrings of the same direction?
With shapely this is shapely.get_geometry(geoms, 0), but not sure if we already expose that in geopandas as well? (I don't see it listed in #2010)

Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
@martinfleis
Copy link
Member Author

With shapely this is shapely.get_geometry(geoms, 0), but not sure if we already expose that in geopandas as well? (I don't see it listed in #2010)

That must have fallen through. I will add it to the list and prepare a PR soon-ish. Will link to the resulting method from here once ready.

CHANGELOG.md Outdated Show resolved Hide resolved
@jorisvandenbossche jorisvandenbossche merged commit d1f4dff into geopandas:main May 18, 2024
20 checks passed
@martinfleis martinfleis deleted the shared_paths branch May 18, 2024 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants