Svelte Maplibre

API / Controls

ScaleControl

Add the MapLibre scale control to the map. This control shows a scale bar for the current zoom level.

Put it inside the MapLibre component. The component uses the props only when it creates the control. Changes to the props after that have no effect.

import { ScaleControl } from 'svelte-maplibre';

Examples

Props

  • position maplibregl.ControlPosition

    Default: 'bottom-left'

  • maxWidth number
  • unit 'imperial' | 'metric' | 'nautical'

    Default: 'metric'

Source: src/lib/ScaleControl.svelte