A leaflet control plugin to make simple rotating compass
JavaScript HTML CSS
Latest commit 95f8727 Oct 29, 2016 @stefanocudini _rotateElement method

README.md

Leaflet.Control.Compass

A leaflet control plugin to make simple rotating compass

Tested in Leaflet 0.7.7

require only HTML5 API

Tested platforms:

  • Chrome on Android
  • Safari on iOS

Demo online:
labs.easyblog.it/maps/leaflet-compass

Image

How to use

Adding the Compass Control to the map:

map.addControl( new L.Control.Compass() );

Settings

  • position position of control inside map
  • autoActive activate control at startup
  • showDigit show angle value bottom compass
  • textErr error message on alert notification
  • callErr function that run on compass error activating
  • angleOffset min angle deviation before rotate, big angleOffset is need for device have noise in orientation sensor

Methods

  • getAngle return Azimut angle
  • setAngle set rotation compass
  • activate active tracking on runtime
  • deactivate deactive tracking on runtime

Events

  • compass:rotated fired after compass data is rotated
  • compass:disabled fired when compass is disabled

Where

Source code:

Github
Bitbucket
Atmosphere NPM