Module: ol/control/ScaleLine

ol/control/ScaleLine


Classes

ScaleLine

Type Definitions

Options{Object}

Properties:
Name Type Description
className string | undefined

CSS class name. The default is ol-scale-bar when configured with bar: true. Otherwise the default is ol-scale-line.

minWidth number
(defaults to 64)

Minimum width in pixels at the OGC default dpi. The width will be adjusted to match the dpi used.

maxWidth number | undefined

Maximum width in pixels at the OGC default dpi. The width will be adjusted to match the dpi used.

render function | undefined

Function called when the control should be re-rendered. This is called in a requestAnimationFrame callback.

target HTMLElement | string | undefined

Specify a target if you want the control to be rendered outside of the map's viewport.

units Units
(defaults to 'metric')

Units.

bar boolean
(defaults to false)

Render scalebars instead of a line.

steps number
(defaults to 4)

Number of steps the scalebar should use. Use even numbers for best results. Only applies when bar is true.

text boolean
(defaults to false)

Render the text scale above of the scalebar. Only applies when bar is true.

dpi number | undefined

dpi of output device such as printer. Only applies when bar is true. If undefined the OGC default screen pixel size of 0.28mm will be assumed.

Units{'degrees'} {'imperial'} {'nautical'} {'metric'} {'us'}

Units for the scale line.