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

intersection and spatial join support for Point arrays #21

Merged
merged 20 commits into from
Jan 10, 2020

Conversation

jonmmease
Copy link
Collaborator

This PR adds an initial partial implementation of the intersects and sjoin operations.

From the updated Overview notebook:

Spatialpandas has limited support for computing intersections between shapes. Currently, intersects can be called on Point arrays and can used to compare to any other scalar geometry type.

Spatialpandas has limited spatial join support using the sjoin function. Currently, the left_df argument to sjoin must be a GeoDataFrame or DaskGeoDataFrame with an active Point geometry column. The right_df argument must be a GeoDataFrame (not DaskGeoDataFrame), but it may have any geometry type.

The most common use-case that this functionality is designed to support is performing a spatial join between a large GeoDataFrame or DaskGeoDataFrame of Points and a small to moderate sized GeoDataFrame of (Multi)Polygons.

As usual, the new functionality is tested against geopandas using hypothesis property tests.

Copy link
Member

@jbednar jbednar left a comment

Choose a reason for hiding this comment

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

Nice!

spatialpandas/geometry/_algorithms/intersection.py Outdated Show resolved Hide resolved

from spatialpandas.geometry.base import GeometryDtype
from spatialpandas.geometry.basefixed import GeometryFixed, GeometryFixedArray
from dask.dataframe.extensions import make_array_nonempty
from spatialpandas.utils import ngpjit
Copy link
Member

Choose a reason for hiding this comment

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

Should these be relative imports? Seems odd to see imports from "spatialpandas" inside spatialpandas.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They could be, but this library is already Python 3 only (due to pandas dependency) so it works either way.

rsuffix: Suffix to apply to overlapping column names from the right GeoDataFrame

Returns:
GeoDataFrame or DaskGeoDataFrame
Copy link
Member

Choose a reason for hiding this comment

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

Where the type returned depends on left_df?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍

@jonmmease jonmmease merged commit 3e2e85a into master Jan 10, 2020
@jonmmease jonmmease deleted the point_intersect branch January 10, 2020 19:22
@jonmmease jonmmease mentioned this pull request Jul 17, 2020
60 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants