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: use query_bulk in fuzzy_contiguity #335

Merged
merged 4 commits into from Dec 10, 2020
Merged

Conversation

martinfleis
Copy link
Member

Reimplements core part of fuzzy_contiguity using new sindex.query_bulk introduced in GeoPandas 0.8.0. It brings cleaner code (once compatibility layer is removed), performance enhancements (438 ms vs 2.58 s for map_RS_BR.shp) and allows specification of predicate, which means that we can generate weights not only based on intersects but also 'within', 'contains', 'overlaps', 'crosses', 'touches' (plus more once pygeos/shapely 2.0 will support them).

At the same time resolves #334.

Note that it now uses the actual index of the GeoDataFrame, not an integer (as per @sjsrey's suggestion).

@codecov
Copy link

codecov bot commented Aug 11, 2020

Codecov Report

Merging #335 into master will decrease coverage by 0.13%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #335      +/-   ##
==========================================
- Coverage   81.22%   81.08%   -0.14%     
==========================================
  Files         115      115              
  Lines       11678    11693      +15     
==========================================
- Hits         9485     9481       -4     
- Misses       2193     2212      +19     
Impacted Files Coverage Δ
libpysal/weights/util.py 75.68% <52.38%> (-1.46%) ⬇️
libpysal/weights/tests/test_util.py 98.20% <100.00%> (+0.04%) ⬆️
libpysal/examples/base.py 53.02% <0.00%> (-6.72%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e65951...d4189a9. Read the comment docs.

libpysal/weights/util.py Show resolved Hide resolved
libpysal/weights/util.py Outdated Show resolved Hide resolved
Copy link
Member

@sjsrey sjsrey left a comment

Choose a reason for hiding this comment

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

Looks great!

@sjsrey sjsrey merged commit a702868 into pysal:master Dec 10, 2020
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.

BUG: fuzzy_contiguity picks more neighbours than it should
4 participants