Giter Site home page Giter Site logo

avantassel / leaflet-usermarker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heyman/leaflet-usermarker

0.0 2.0 0.0 203 KB

Leaflet plugin for plotting a marker representing a user, or multiple users, on a Leaflet map

License: MIT License

leaflet-usermarker's Introduction

Leaflet UserMarker

UserMarker is a leaflet plugin for plotting a marker representing a user, or multiple users, on a map.

longitude.me

Features

Leaflet UserMarker is an iOS style marker for representing users on a map. It extends Leaflet's Marker class, so everything you can do with a normal marker - like setting lat/lng and binding popups - can be done with UserMarker's as well. In addition to this, UserMarker has the following features:

  • Ability to set accuracy which will be displayed as a blue, transparent circle around the marker.
  • Turn on/off a "pulsing" effect that can be used to represent high accuracy, or if a user is online.

See it in action

Leaflet UserMarker can be seen in action on Longitude.me.

You can also see the bundled examples.

Example Code

Create a user marker and add it to a map:

var marker = L.userMarker([5.45, 70.56]);
marker.addTo(map);

Set accuracy on an existing marker:

marker.setAccuracy(400); // 400 meters accuracy

Create a "pulsing" marker with small icon and accuracy 100:

var marker = L.userMarker(latlng, {pulsing:true, accuracy:100, smallIcon:true});
marker.addTo(map);

Locate the map viewers position and display a UserMarker:

map.on("locationfound", function(location) {
    if (!marker)
        marker = L.userMarker(location.latlng).addTo(map);

    marker.setLatLng(location.latlng);
    marker.setAccuracy(location.accuracy);
});
map.locate({
    watch: false,
    locate: true,
    setView: true,
    enableHighAccuracy: true
});

Author

Usermarker is developed by Jonatan Heyman.

Another website of mine is boutiquehotel.me, which is a site for finding great boutique hotels all around the world. For example, check out boutique hotels in Stockholm, London, New York, or Berlin.

License

MIT License

leaflet-usermarker's People

Contributors

heyman avatar

Watchers

Andrew Van Tassel avatar 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.