Skip to content

Commit

Permalink
warn user if geometry is much larger than max query area size
Browse files Browse the repository at this point in the history
  • Loading branch information
gboeing committed Dec 25, 2023
1 parent 79209dd commit bf28e29
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions osmnx/utils_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,17 @@ def _consolidate_subdivide_geometry(geometry):
):
geometry = geometry.convex_hull

# warn user if they passed a geometry with area much larger than max size
ratio = int(geometry.area / mqas)
warning_threshold = 10
if ratio > warning_threshold:
msg = (

Check warning on line 281 in osmnx/utils_geo.py

View check run for this annotation

Codecov / codecov/patch

osmnx/utils_geo.py#L281

Added line #L281 was not covered by tests
f"This area is {ratio:,} times your configured Overpass max query "
"area size. It will automatically be divided up into multiple "
"sub-queries accordingly. This may take a long time."
)
warn(msg, stacklevel=2)

Check warning on line 286 in osmnx/utils_geo.py

View check run for this annotation

Codecov / codecov/patch

osmnx/utils_geo.py#L286

Added line #L286 was not covered by tests

# if geometry area exceeds max size, subdivide it into smaller subpolygons
# that are no greater than settings.max_query_area_size in size
if geometry.area > mqas:
Expand Down

0 comments on commit bf28e29

Please sign in to comment.