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

DOC: add a guide on spatial indexing #3498

Merged
merged 10 commits into from
Mar 1, 2025

Conversation

martinfleis
Copy link
Member

What the title says. Adding it to Advanced guide as basic stuff can be done without interacting with the sindex ever via sjoin and friends.

Copy link
Member

@brendan-ward brendan-ward left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @martinfleis ; overall this looks great. I added some text suggestions to consider.

Is there a way to avoid the Out[33]: <Axes: > in the rendered code outputs? (looking at readthedocs output here)

@martinfleis
Copy link
Member Author

Is there a way to avoid the Out[33]: <Axes: > in the rendered code outputs?

I spent some time playing with it while writing this with no solution. The only one we could opt for is switching RST for ipynb and let nbsphinx parse it. Then it will consider the whole cell as one In: but then I don't think we can do automatic linking to API. I might look into MyST if that could be a solution....

Copy link
Member

@m-richards m-richards left a comment

Choose a reason for hiding this comment

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

I think this is quite a nice explanation of how sindex can be leveraged, I guess the real test comes when users try it but it's a solid foundation.

Note that for many operations where a spatial index provides significant
performance benefits, GeoPandas already uses it automatically (like :meth:`~GeoDataFrame.sjoin`,
:meth:`~GeoDataFrame.overlay`, or :meth:`~GeoDataFrame.clip`). However, more advanced use cases may require
a direct interaction with the index.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could mention the many-to-many case up front as an example of a situation where direct interaction makes sense?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure I follow what you meant...

@martinfleis martinfleis added this to the 1.1 milestone Jan 30, 2025
@martinfleis martinfleis merged commit 695886f into geopandas:main Mar 1, 2025
18 checks passed
@martinfleis martinfleis deleted the sindex-guide branch March 1, 2025 09:27
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.

None yet

3 participants