maplibre-scale-factory
v1.1.0
Published
MapLibre Scale Factory is a plugin to display metric and imperial scales in MapLibre GL JS.
Downloads
170
Maintainers
Readme
maplibre-scale-factory
MapLibre Scale Factory is a plugin to display metric and imperial scales in MapLibre GL JS.
Features
- Scales in metric and imperial units with optional label overflow
- Custom max width
Installation
npm install maplibre-scale-factoryApi
Scale Factory Options
| Option | Type | Default | Description | Mandatory |
| - | - | - | - | - |
| maxWidth| number | 120 | Max width of the scale bar | No |
| withLabelOverflow| boolean | false | Show full label even if it overflows | No |
Example
The example below shows how to use the MapLibre Scale Factory to display metric and imperial scale bars.
import { MapLibreScaleFactory } from "maplibre-scale-factory";
import "maplibre-scale-factory/style.css";
const scaleFactory = new MapLibreScaleFactory({ withLabelOverflow: false });
map.addControl(scaleFactory, "bottom-left");Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
