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

Method fit_bounds

folium/folium.py:431–471  ·  view source on GitHub ↗

Fit the map to contain a bounding box with the maximum zoom level possible. Parameters ---------- bounds: list of (latitude, longitude) points Bounding box specified as two points [southwest, northeast] padding_top_left: (x, y) point, default None

(
        self,
        bounds: TypeBounds,
        padding_top_left: Optional[Sequence[float]] = None,
        padding_bottom_right: Optional[Sequence[float]] = None,
        padding: Optional[Sequence[float]] = None,
        max_zoom: Optional[int] = None,
    )

Source from the content-addressed store, hash-verified

429 pass
430
431 def fit_bounds(
432 self,
433 bounds: TypeBounds,
434 padding_top_left: Optional[Sequence[float]] = None,
435 padding_bottom_right: Optional[Sequence[float]] = None,
436 padding: Optional[Sequence[float]] = None,
437 max_zoom: Optional[int] = None,
438 ) -> None:
439 """Fit the map to contain a bounding box with the
440 maximum zoom level possible.
441
442 Parameters
443 ----------
444 bounds: list of (latitude, longitude) points
445 Bounding box specified as two points [southwest, northeast]
446 padding_top_left: (x, y) point, default None
447 Padding in the top left corner. Useful if some elements in
448 the corner, such as controls, might obscure objects you're zooming
449 to.
450 padding_bottom_right: (x, y) point, default None
451 Padding in the bottom right corner.
452 padding: (x, y) point, default None
453 Equivalent to setting both top left and bottom right padding to
454 the same value.
455 max_zoom: int, default None
456 Maximum zoom to be used.
457
458 Examples
459 --------
460 >>> m.fit_bounds([[52.193636, -2.221575], [52.636878, -1.139759]])
461
462 """
463 self.add_child(
464 FitBounds(
465 bounds,
466 padding_top_left=padding_top_left,
467 padding_bottom_right=padding_bottom_right,
468 padding=padding,
469 max_zoom=max_zoom,
470 )
471 )
472
473 def keep_in_front(self, *args: Layer) -> None:
474 """Pass one or multiple layers that must stay in front.

Callers 2

test_fit_boundsMethod · 0.45
test_fit_bounds_2Method · 0.45

Calls 2

FitBoundsClass · 0.90
add_childMethod · 0.45

Tested by 2

test_fit_boundsMethod · 0.36
test_fit_bounds_2Method · 0.36