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 bbox_from_point #541

Merged
merged 7 commits into from
Jul 24, 2020
Merged

optimize bbox_from_point #541

merged 7 commits into from
Jul 24, 2020

Conversation

gboeing
Copy link
Owner

@gboeing gboeing commented Jul 24, 2020

resolves #540

@coveralls
Copy link

coveralls commented Jul 24, 2020

Coverage Status

Coverage increased (+0.2%) to 92.697% when pulling f874ab5 on fix into 4a8aaa0 on master.

@gboeing
Copy link
Owner Author

gboeing commented Jul 24, 2020

As a simple test:

import osmnx as ox
dist = 500
point = 37, -117
north, south, east, west = ox.utils_geo.bbox_from_point(point, dist=dist, project_utm=True)
print((north - south) / 2 - dist) #-1.177
print((east - west) / 2 - dist) #0.997
print(ox.utils_geo.bbox_to_poly(north, south, east, west).area) #999636

This desired 1 km^2 projected bounding box is within ~1 meter of expected linear dimensions and has area of 0.9996 km^2.

The new implementation of ox.utils_geo.bbox_from_point is several thousand times faster than the old.

@gboeing gboeing merged commit e1bfad3 into master Jul 24, 2020
@gboeing gboeing deleted the fix branch July 24, 2020 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants