GithubHelp home page GithubHelp logo

exscotticus / leaflet.mapcentercoord Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xguaita/leaflet.mapcentercoord

0.0 1.0 0.0 116 KB

A Leaflet control to display the coordinates of the map center, especially useful on mobile/touch devices

Home Page: http://xguaita.github.io/Leaflet.MapCenterCoord/

License: MIT License

JavaScript 94.71% CSS 5.29%

leaflet.mapcentercoord's Introduction

Leaflet.MapCenterCoord

A Leaflet control to display the coordinates of the map center, especially useful on touch/mobile devices.

The initial idea was based on the plugin Leaflet.MousePosition.

Requirements

Leaflet v7.x
Tested ok on Leaflet 1.0 beta2

Some tested platforms

Android 4.4.2: Google Chrome 47 and stock browser
iOS 9.2: Safari

Desktops: Windows 7, Windows 10, Ubuntu 14.04 LTS
Google Chrome 47, Firefox 43, Microsoft Internet Explorer 10, 11 and Edge 25

Examples

http://xguaita.github.io/Leaflet.MapCenterCoord/

Sources in /examples folder

Install

  • Download latest release

    • Source code in /src folder
    • Minified versions in /dist
  • Include js and css files located in the /dist folder (production) or /src (development)

  • If you want to change the code and build minified versions:
    First, install node.js on your system. Then run npm install to build the minified js and css into /dist

Usage

Add the following line to your map initialization:

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

You can also pass a configuration.

Configuration options

The MapCenterCoord control inherits options from Leaflet Controls.

Option Type Default Description
position String 'bottomleft' The standard Leaflet.Control position parameter
icon Boolean true Shows crosshair icon on map center
onMove Boolean false Update the coordinates of the map center while dragging
template String '{y} | {x}' Display template
latlngFormat String 'DD' Show lat/lng coordinates in 3 possible formats:
Decimal degrees 'DD' (DDD.DDDDD°)
Degrees and decimal minutes 'DM' (DDD° MM.MMM')
Degrees, minutes and seconds 'DMS' (DDD° MM' SS.S")
latlngDesignators Boolean false Show N-S and E-W
projected Boolean false Show projected coordinates
formatProjected String '#.##0,0' Number format mask for projected coordinates.
JavaScript Number Formatter project: sample/help page
latLngFormatter Function undefined Function that takes the lattitude and longitude as arguments and returns a single formatted string, e.g.
function (lat, lng) {
return lat + " north and " + lng + " west";
}

License

This software is released under the MIT license.

leaflet.mapcentercoord's People

Contributors

xguaita avatar n2zlc avatar tstibbs avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.