shaefner-usgs / Leaflet.MousePosition

A mouse position control for Leaflet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

leaflet-mouse-position

Leaflet.MousePosition is a mouse position control that you can add to a Leaflet map. It displays the geographic coordinates of the mouse pointer, as it is moved around the map.

Screenshot

Usage Example

Insert the following line:

L.control.mousePosition(<Object> options?).addTo(map);

or during map initialization:

positionControl: true

Options

emptystring: Initial text to display. Default is ''.

latFormatter: Custom function to format the latitude value. Argument: numerical latitude value. Return value: formatted string. Default is e.g. 37.298°N.

lngFirst: Whether to put the longitude first or not. Default is false.

lngFormatter: Custom function to format the longitude value. Argument: numerical longitude value. Return value: formatted string. Default is e.g. 121.630°W.

numDigits: Number of digits. Default is 3.

position: The standard Leaflet.Control position parameter. Default is 'bottomcenter'.

prefix: A string to be prepended to the coordinates. Default is ''.

separator: To separate longitude\latitude values. Default is ', '.

Public Method

getLatLng: Request the last recorded cursor position, as a LatLng object.

License

MIT License (MIT)

About

A mouse position control for Leaflet

License:Other


Languages

Language:JavaScript 79.3%Language:CSS 10.5%Language:SCSS 10.2%