new Scale(optionsopt) → {Scale}
Create a new scale bar.
Parameters
-
options
object
<optional>
Options.
Properties
-
title
string
<optional>
'Scale'Title of the control.
-
position
'bottomleft'
|'bottomright'
|'topleft'
|'topright'
<optional>
'topright'Position of the scale bar.
-
maxWidth
number
<optional>
128Maximum length of the scale bar.
-
metric
boolean
<optional>
falseShow metric scale?
-
metricTitle
string
<optional>
Title of the control in metric mode. Defaults to global title.
-
imperial
boolean
<optional>
falseShow imperial scale?
-
imperialTitle
string
<optional>
Title of the control in imperial mode. Defaults to global title.
-
degrees
boolean
<optional>
trueShow scale in degrees/arcminutes/arcseconds?
-
degreesTitle
string
<optional>
Title of the control in degrees mode. Defaults to global title.
-
pixels
boolean
<optional>
falseShow scale in pixels?
-
pixelsTitle
string
<optional>
Title of the control in pixels mode. Defaults to global title.
-
custom
boolean
<optional>
falseShow custom scale?
-
customTitle
string
<optional>
Title of the control in custom mode. Defaults to global title.
-
customScale
number
<optional>
1.0Scaling factor for the custom scale.
-
customUnits
string
<optional>
''Units of the custom scale.
-
updateWhenIdle
boolean
<optional>
falseUpdate only when the map stops moving?
-
planetRadius
number
<optional>
Planet radius (in meters) for the metric and imperial modes.
-
title
Returns
-
Scale
Instance of a scale bar.
Source
Methods
_addScales(options, className, container)
Add the scale bar(s).
Parameters
-
options
object
Scale bar options (see {link @Scale} for details).
-
className
string
Element class name for the scale bar.
-
container
object
Scale bar container
Source
_jacobian() → {number}
Return the Jacobian determinant of the deprojection at the given world coordinates.
Parameters
-
leaflet.LatLng
Returns
-
number
Jacobian determinant of the deprojection.
Source
_update()
Update the scale bar(s).
Source
_updateCustom(maxCust, units)
Update the custom scale.
Parameters
-
maxCust
number
Maximum scale value in custom units.
-
units
string
Custom units.
Source
_updateDegrees(maxdegrees)
Update the degree scale.
Parameters
-
maxdegrees
number
Maximum scale value in pixel units.
Source
_updatePixels(maxPix)
Update the pixel scale.
Parameters
-
maxPix
number
Maximum scale value in pixel units.