foliplus.ScaleControl#

class foliplus.ScaleControl(*, metric: bool = True, show_zoom: bool = True, locale: str | LocaleConfig | None = None)[source]#

Bases: BaseControl

Scale bar with metric units and optional zoom level display.

Parameters#

metricbool, default True

Whether to show metric units (meters / kilometers).

show_zoombool, default True

Whether to show the current map zoom level.

localestr or LocaleConfig, optional

Language code ("en", "zh") or a LocaleConfig instance. Defaults to auto-detection, falling back to English.

Examples#

>>> import folium
>>> from foliplus import ScaleControl
>>> m = folium.Map()
>>> ScaleControl().add_to(m)
__init__(*, metric: bool = True, show_zoom: bool = True, locale: str | LocaleConfig | None = None)[source]#

Methods

__init__(*[, metric, show_zoom, locale])

add_child(child[, name, index])

Add a child.

add_children(child[, name, index])

Add a child.

add_css_link(name, url)

Add or update css resource link.

add_js_link(name, url)

Add or update JS resource link.

add_to(parent[, name, index])

Add element to a parent.

get_bounds()

Computes the bounds of the object and all it's children in the form [[lat_min, lon_min], [lat_max, lon_max]].

get_name()

Returns a string representation of the object.

get_root()

Returns the root of the elements tree.

render(**kwargs)

Renders the HTML representation of the element.

save(outfile[, close_file])

Saves an Element into a file.

to_dict([depth, ordered])

Returns a dict representation of the object.

to_json([depth])

Returns a JSON representation of the object.

Attributes

default_css

default_js