Giter VIP home page Giter VIP logo

leaflet-compass's Introduction

Leaflet.Control.Compass

npm version

A leaflet control plugin to make simple rotating compass

If this project helped your work help me to keep this alive by Paypal DONATION ❤

Tested in Leaflet 0.7 and 1.2

require HTML5 API on mobile device!

Try the Demo online here:
opengeo.tech/maps/leaflet-compass

Tested platforms:

this project needs many tests on different devices, please help us using the demo page and report problems by opening an issue.

  • Chrome on Android
  • Safari on iOS

Image

Usage

Adding the Compass Control to the map:

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

Options

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

Methods

Method Arguments Description
autoActive false activate control at startup
getAngle return Azimut angle
setAngle angle set rotation compass
activate active tracking on runtime
deactivate deactive tracking on runtime

Events

Event Data Description
'compass:rotated' angle fired after compass data is rotated
'compass:disabled' fired when compass is disabled

Where

Source code:

Github
NPM

leaflet-compass's People

Contributors

dependabot[bot] avatar mirabilos avatar stefanocudini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

leaflet-compass's Issues

does not works on FireFox 45

Hi
Perhaps this._divcompass.style.webkitTransform = "rotate(" + angle + "deg)"; is not available in FireFox.

nota: it works with Chromium 48.

Any @types for angular ?

I try to add this in angular, and so far I could not... even extend module on top.

Property 'Compass' does not exist on type 'typeof Control'.ts(2339)

Seems compass not accurate

I use the example, compass working and direction showing accurate..

But when tested on latest leaflet version 1.9, the compass showing wrong direction..

Tested in Android Pie, using browser Chrome dan Firefox.

show compass needs calibration message

window.addEventListener("compassneedscalibration", function(event) {
alert('Your compass needs calibrating! Wave your device in a figure-eight motion');
event.preventDefault();
}, true);

@types for TypeScript

I would like to experiment with leaflet-compass however, I am having trouble creating the required typescript definitions.
I am not using angular.

Apply rotation to the map

Hello team, great works!
One question. How to apply the same rotation to the map, instead of to the compass?

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.