2.0.0 • Published 4 months ago
leaflet-auto-graticule v2.0.0
Leaflet.AutoGraticule
A graticule for maps showing Latitude and Longitude, with automatic adjustment to the zoom level.
Based on Leaflet.SimpleGraticule.
Usage
If you are using a module bundler, you can install Leaflet.AutoGraticule using npm install -S leaflet-auto-graticule
and use it in your code like so:
import AutoGraticule from "leaflet-auto-graticule";
new AutoGraticule().addTo(map);
TypeScript is supported. Note that when including Leaflet.AutoGraticule like this, L.AutoGraticule
is not available on the global L
leaflet object.
If you want to use Leaflet.AutoGraticule in a static HTML page, load it after Leaflet:
<script src="https://unpkg.com/leaflet"></script>
<script src="https://unpkg.com/leaflet-auto-graticule"></script>
<script>
new L.AutoGraticule().addTo(map);
</script>
Options
var options = {
/** Leaflet map event on which to redraw the graticule. */
redraw: 'moveend',
/** Minimum distance in pixels between two graticule lines. */
minDistance: 100
};
new L.AutoGraticule(options).addTo(map);