MCPcopy
hub / github.com/python-visualization/folium / get_bounds

Function get_bounds

folium/utilities.py:313–336  ·  view source on GitHub ↗

Computes the bounds of the object in the form [[lat_min, lon_min], [lat_max, lon_max]]

(
    locations: Any,
    lonlat: bool = False,
)

Source from the content-addressed store, hash-verified

311
312
313def get_bounds(
314 locations: Any,
315 lonlat: bool = False,
316) -> List[List[Optional[float]]]:
317 """
318 Computes the bounds of the object in the form
319 [[lat_min, lon_min], [lat_max, lon_max]]
320
321 """
322 bounds: List[List[Optional[float]]] = [[None, None], [None, None]]
323 for point in iter_coords(locations):
324 bounds = [
325 [
326 none_min(bounds[0][0], point[0]),
327 none_min(bounds[0][1], point[1]),
328 ],
329 [
330 none_max(bounds[1][0], point[0]),
331 none_max(bounds[1][1], point[1]),
332 ],
333 ]
334 if lonlat:
335 bounds = _locations_mirror(bounds)
336 return bounds
337
338
339def normalize_bounds_type(bounds: TypeBounds) -> TypeBoundsReturn:

Callers 8

_get_self_boundsMethod · 0.90
_get_self_boundsMethod · 0.90
_get_self_boundsMethod · 0.90
_get_self_boundsMethod · 0.90
_get_self_boundsMethod · 0.90
test_polygon_markerFunction · 0.90
test_polylineFunction · 0.90
test_mulyipolylineFunction · 0.90

Calls 1

iter_coordsFunction · 0.85

Tested by 3

test_polygon_markerFunction · 0.72
test_polylineFunction · 0.72
test_mulyipolylineFunction · 0.72