Skip to content

Scale

Scale is the scale control. It extends Control. It shows a map scale bar on the map according to the current zoom level, with both metric and imperial units supported. It is displayed by default at the bottom-left corner.

js
import { Scale } from "maptalks";

const scale = new Scale({
  metric: true,
  imperial: false
}).addTo(map);

Constructor

js
new Scale(options)

Parameters:

  • options — Scale control options.

options

NameTypeDescriptionDefault
positionStringThe control position"bottom-left"
maxWidthNumberThe maximum width of the scale bar (px)100
metricBooleanWhether metric units are showntrue
imperialBooleanWhether imperial units are shownfalse
containerClassStringThe CSS class of the containernull