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

Unhashable Geometries #221

Open
jwass opened this Issue Sep 9, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@jwass
Copy link
Member

jwass commented Sep 9, 2015

Hi Geopandans. Long time, no see.

Over at Toblerity/Shapely#320, Shapely geometries are soon to be unhashable i.e., __hash__ will return None because geometry objects are mutable. In preparation we should remove any GeoPandas dependence on the geometry hash, which is any join/merge operation that includes the geometry column in the list of fields to join. The change will also break the code of anyone who is already doing this, although my guess is it's a rare use case at least when done intentionally.

From what I can tell, there are no changes to GeoPandas itself that are required, but there are two changes I propose:

  • Remove the one test, test_sindex.TestJoinSindex.test_merge_geo which uses the geometry column in a merge. That way, the tests will pass once the change is made to Shapely. This one is straightforward and I'll submit a PR soon.
  • Add the ability for sjoin to explicitly perform a spatial join using an equals predicate, likely by adding an eq operation and also an is predicate testing for the same object. That way anyone affected by the change will have some recourse and can recover the original behavior. It's also a better way for GeoPandas to define all spatial joins in the same place, rather than the previous implicit behavior using the hash.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment