Skip to content

Commit

Permalink
Finer bbox division for too large REST API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik-Geo committed Jul 9, 2024
1 parent a20848b commit af08ffd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions geost/bro/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ def search_objects_in_bbox(
bro_objects = self.__objects_from_etree(etree_root)
elif response.status_code == 400 or "groter dan 2000" in response.text:
bro_objects = []
division_levels = int(((xmax - xmin + ymax - ymin)) / 2000)
division_levels = int(((xmax - xmin + ymax - ymin)) / 1000)
division_x = (xmax - xmin) / division_levels
for division_level in range(division_levels):
print(
f"More than 2000 object requests in API call, dividing calls. Current call {division_level}/{division_levels}"
f"More than 2000 object requests in API call, dividing calls. Current call {division_level+1}/{division_levels}"
)
xmin_divided = xmin + (division_level * division_x)
xmax_divided = xmin + ((division_level + 1) * division_x)
Expand Down

0 comments on commit af08ffd

Please sign in to comment.