Skip to content

Commit 80585be

Browse files
author
Sean Sullivan
committed
put bounds on expanded bbox for legend
1 parent 325411b commit 80585be

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

elastic_datashader/routers/legend.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def expand_bbox_by_meters(bbox, meters):
2626
top_left_lon, top_left_lat = line_of_bearing(bbox['top_left']['lon'], bbox['top_left']['lat'], 315, meters)
2727
bottom_right_lon, bottom_right_lat = line_of_bearing(bbox['bottom_right']['lon'], bbox['bottom_right']['lat'], 135, meters)
2828
return {
29-
"top_left": {'lon': top_left_lon, 'lat': top_left_lat},
30-
"bottom_right": {'lon': bottom_right_lon, 'lat': bottom_right_lat},
29+
"top_left": {'lon': min(180, max(-180, top_left_lon)), 'lat': min(90, max(-90, top_left_lat))},
30+
"bottom_right": {'lon': min(180, max(-180, bottom_right_lon)), 'lat': min(90, max(-90, bottom_right_lat))},
3131
}
3232

3333
def legend_response(data: str, error: Optional[Exception]=None, **kwargs) -> Response:
@@ -123,7 +123,6 @@ async def provide_legend(idx: str, field_name: str, request: Request): # pylint
123123
# you can sometimes see a little tiny part of the ellipse and it isn't counted
124124
meters = params['search_nautical_miles'] * 1852
125125
legend_bbox = expand_bbox_by_meters(legend_bbox, meters/2)
126-
logger.info("legend_bbox: %s", legend_bbox)
127126
base_s = base_s.filter("geo_bounding_box", **{geopoint_field: legend_bbox})
128127

129128
legend_s = copy(base_s)

elastic_datashader/tilegen.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ def create_datashader_ellipses_from_search(
365365
field_names: EllipseFieldNames,
366366
ellipse_units: str,
367367
maximum_ellipses_per_tile,
368-
search_meters,
369368
histogram_interval,
370369
category_type,
371370
category_format,
@@ -647,7 +646,6 @@ def generate_nonaggregated_tile(
647646
field_names,
648647
params["ellipse_units"],
649648
params["max_ellipses_per_tile"],
650-
search_meters,
651649
histogram_interval,
652650
params["category_type"],
653651
params["category_format"],

0 commit comments

Comments
 (0)