Computes the bounds of the object in the form [[lat_min, lon_min], [lat_max, lon_max]]
(
locations: Any,
lonlat: bool = False,
)
| 311 | |
| 312 | |
| 313 | def 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 | |
| 339 | def normalize_bounds_type(bounds: TypeBounds) -> TypeBoundsReturn: |