# leaflet-mouse-position

> An npm wrapper for Ardhi Lukianto’s Leaflet.MousePosition plugin

Latest version **1.2.0** (published 2019-06-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install leaflet-mouse-position
pnpm add leaflet-mouse-position
yarn add leaflet-mouse-position
bun add leaflet-mouse-position
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-06-04 |
| First published | 2016-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/leaflet-mouse-position) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 33.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | https://github.com/ardhi |
| Maintainers | danwild |
| Keywords | leaflet, leafletjs |

## Links

- npm: https://www.npmjs.com/package/leaflet-mouse-position
- Repository: https://github.com/danwild/Leaflet.MousePosition
- Homepage: https://github.com/danwild/Leaflet.MousePosition#readme
- Issues: https://github.com/danwild/Leaflet.MousePosition/issues
- npm.io page: https://npm.io/package/leaflet-mouse-position

## Recent versions

- 1.2.0 (latest) — 2019-06-04
- 1.1.0 — 2019-05-29
- 1.0.4 — 2018-07-18
- 1.0.3 — 2018-07-18
- 1.0.2 — 2018-07-18
- 1.0.1 — 2016-06-15
- 1.0.0 — 2016-05-25

## README

# leaflet-mouse-position [![npm version][npm-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url]

Leaflet.MousePosition is a simple mouse position control that you can drop into your leaflet map. It displays geographic coordinates of the mouse pointer, as it is moved about the map.

![Screenshot](/screenshot/sample.png?raw=true)

## Using the Mouse Position Control

Insert the following line:

    ...
    L.control.mousePosition().addTo(map);
    ...

## Available Options:

These are the available options:

`position:` The standard Leaflet.Control position parameter. Defaults to 'bottomleft'

`separator:` To separate longitude\latitude values. Defaults to ' : '

`emptystring:` Initial text to display. Defaults to 'Unavailable'

`numDigits:` Number of digits. Defaults to 5

`lngFirst:` Weather to put the longitude first or not. Defaults to false

`lngFormatter:` Custom function to format the longitude value. Argument: numerical longitude value. Return value: formatted string. Defaults to undefined.

`latFormatter:` Custom function to format the latitude value. Argument: numerical latitude value. Return value: formatted string. Defaults to undefined.

`prefix:` A string to be prepended to the coordinates. Defaults to the empty string ‘’.

`wrapLng:` Controls if longitude values will be [wrapped](https://leafletjs.com/reference-1.5.0.html#latlng-wrap). Defaults to true.

`formatter:` A custom function to format the entire value. Arguments: numerical longitude value, numerical latitude value. Return value: formatted string.
 Defaults to undefined. If defined will ignore: `lngFirst`, `lngFormatter`, `latFormatter` and `prefix`.

## Public Methods:

These are the available methods:

`getLatLng:` Request the last recorded cursor position, as a
[LatLng](https://leafletjs.com/reference-1.3.2.html#latlng) object.

## License

MIT License (MIT)

[npm-image]: https://badge.fury.io/js/leaflet-mouse-position.svg
[npm-url]: https://www.npmjs.com/package/leaflet-mouse-position
[npm-downloads-image]: https://img.shields.io/npm/dt/leaflet-mouse-position.svg

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