# leaflet-auto-graticule

> Leaflet graticule with automatic adaption to zoom level.

Latest version **2.0.0** (published 2023-12-25) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install leaflet-auto-graticule
pnpm add leaflet-auto-graticule
yarn add leaflet-auto-graticule
bun add leaflet-auto-graticule
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2023-12-25 |
| First published | 2020-03-13 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 44.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Maintainers | cdauth |

## Links

- npm: https://www.npmjs.com/package/leaflet-auto-graticule
- Repository: https://github.com/FacilMap/Leaflet.AutoGraticule
- npm.io page: https://npm.io/package/leaflet-auto-graticule

## Recent versions

- 2.0.0 (latest) — 2023-12-25
- 1.1.2 — 2023-04-04
- 1.1.1 — 2022-12-12
- 1.1.0 — 2022-04-16
- 1.0.9 — 2021-02-26
- 1.0.8 — 2021-02-22
- 1.0.7 — 2021-02-06
- 1.0.6 — 2021-01-22
- 1.0.4 — 2021-01-22
- 1.0.3 — 2021-01-21
- 1.0.2 — 2020-03-14
- 1.0.1 — 2020-03-13
- 1.0.0 — 2020-03-13

## README

Leaflet.AutoGraticule
=====================

A graticule for maps showing Latitude and Longitude, with automatic adjustment to the zoom level.

Based on [Leaflet.SimpleGraticule](https://github.com/ablakey/Leaflet.SimpleGraticule).

[Demo](https://esm.sh/leaflet-auto-graticule/example.html)\
[Demo on FacilMap](https://facilmap.org/#3/0.00/0.00/MSfR-grid)

Usage
-----

Since release 2.0.0, Leaflet.AutoGraticule is published as an ES module only. Install it using `npm install -S leaflet-auto-graticule` and use it in your code like so:
```javascript
import AutoGraticule from "leaflet-auto-graticule";

new AutoGraticule().addTo(map);
```

TypeScript is supported.

If you want to use Leaflet.AutoGraticule directly inside a website without using a module bundler (not recommended for production), you need to make sure to import it and Leaflet as a module, for example from esm.sh:

```html
<script type="importmap">
	{
		"imports": {
			"leaflet": "https://esm.sh/leaflet",
			"leaflet-auto-graticule": "https://esm.sh/leaflet-auto-graticule"
		}
	}
</script>
<script type="module">
	import L from "leaflet";
	import AutoGraticule from "leaflet-auto-graticule";

	const map = L.map('map', { center: [0, 0], zoom: 5 });
	L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
		attribution: '© <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
		noWrap: true
	}).addTo(map);
	new AutoGraticule().addTo(map);
</script>
```

## Options

```javascript
const 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);
```

---
_Source: https://npm.io/package/leaflet-auto-graticule · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
