Skip to content

LControlScale

A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems.

Demo

vue
<LMap style="height: 350px" :zoom="8" :center="[47.21322, -1.559482]">
  <LTileLayer
    url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
    attribution="&amp;copy; <a href=&quot;https://www.openstreetmap.org/&quot;>OpenStreetMap</a> contributors"
    layer-type="base"
    name="OpenStreetMap"
  />
  <LControlScale position="topright" :imperial="true" :metric="false" />
</LMap>

Props

Prop nameDescriptionTypeRequiredDefault
maxWidthMaximum width of the control in pixels. The width is set dynamically to show round values (eg. 100, 200, 500).Number-100
metricWhether to show the metric scale line (m/km).Boolean-true
imperialWhether to show the imperial scale line (mi/ft).Boolean-true
updateWhenIdleIf true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).Boolean-false

Inherited props

from control.ts
Prop nameDescriptionTypeRequiredDefault
positionThe position of the control (one of the map corners). Possible values are topleft, topright, bottomleft or bottomright.String as L.ControlPosition-'topright'
from component.ts
Prop nameDescriptionTypeRequiredDefault
optionsLeaflet options to pass to the component constructorObject-{}

Events

Event nameTypeDescription
readyobjectTriggers when the component is ready