computeScaleBar
Chooses a round-number scale bar that fits in maxWidthPx.
This is a function exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { computeScaleBar } from "@mapcairn/core";
function computeScaleBar(input: ScaleBarInput): ScaleBar;
Description
Steps are 1, 2 or 5 times a power of ten. Metric switches from metres to kilometres at 1,000 m and imperial from feet to miles at one mile. When the input cannot produce a bar (zero, negative or non-finite resolution or width) it returns a zero-width bar instead of throwing.
Parameters
input(ScaleBarInput)
Returns
ScaleBar