foliplus.MeasureControl#

class foliplus.MeasureControl(*, position: Literal['topleft', 'topright', 'bottomleft', 'bottomright'] = 'bottomright', locale: str | LocaleConfig | None = None)[source]#

Bases: BaseControl

Distance measurement, circle drawing, and GPS marker with geocoding.

  • 📍 Locate: click to place a marker showing coordinates and reverse-geocoded address. Click the popup or the Ă— on the marker to delete it.

  • 📏 Distance: click to draw a polyline. Segment and total distances update in real-time. Double-click / right-click / click the last point to finish.

  • â­• Circle: first click sets the center; move the mouse to set the radius; second click confirms.

  • 🗑️ Clear: remove all measurement layers at once.

After drawing a line or circle: click the object to toggle labels and Ă— buttons; click empty map space to hide Ă— buttons.

Parameters#

positionstr, default “bottomright”

One of "topleft", "topright", "bottomleft", "bottomright".

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 MeasureControl
>>> m = folium.Map()
>>> MeasureControl().add_to(m)
__init__(*, position: Literal['topleft', 'topright', 'bottomleft', 'bottomright'] = 'bottomright', locale: str | LocaleConfig | None = None)[source]#

Methods

__init__(*[, position, 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

default_js: List[Tuple[str, str]] = [('gcoord', 'https://cdn.jsdelivr.net/npm/gcoord@1/dist/gcoord.global.prod.js')]#