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

Optimize setbacks joins #84

Closed
MRossol opened this issue Jan 29, 2021 · 1 comment
Closed

Optimize setbacks joins #84

MRossol opened this issue Jan 29, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@MRossol
Copy link
Collaborator

MRossol commented Jan 29, 2021

Bug Description
sjoin here is super slow:

tmp = gpd.sjoin(features, cnty,

Expected behavior
Use spatial index and bounding box to speed it up

                idx_generator = features.sindex.intersection(cnty.total_bounds)
                idx = [i for i in idx_generator]
                buildings = features.iloc[idx]
                centroids = buildings.centroid
                incentroids = [(i, c) for i, c in enumerate(centroids) if c.within(cnty["geometry"].values[0])]
                idx2 = [i[0] for i in incentroids]
                buildings = buildings.iloc[idx2]
                buildings['geometry'] = buildings.buffer(setback)
                setbacks.extend((geom, 1) for geom in buildings['geometry'])

Charge code
WEPG 10348 08.01.01

@MRossol MRossol added the bug Something isn't working label Jan 29, 2021
@MRossol MRossol self-assigned this Jan 29, 2021
@MRossol
Copy link
Collaborator Author

MRossol commented Feb 5, 2021

fixed in #86

@MRossol MRossol closed this as completed Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant