Git Product home page Git Product logo

leaflet.measure's Introduction

Leaflet.Measure

Leaflet.Measure Is a leaflet plugin for measuring distances and areas.

Online DEMO.

Example

// 1. add control to map
var map = L.map("map", {
        center: [29, 120],
    });
L.control.measure().addTo(map);

// 2. using action directly
var measureAction = new L.MeasureAction(map, {
    model: "distance", // 'area' or 'distance', default is 'distance'
});
// measureAction.setModel('area');
measureAction.enable();

L.Control.Measure

Options

Option Type Default Description
position String 'topleft' The position of the control.
title String 'Measurement' The title of the control.
collapsed Boolean false If true, the control will be collapsed into an icon and expanded on mouse hover or touch.
color String '#FF0080' The color of the lines or polygons.

L.MeasureAction

Options

Option Type Default Description
model String 'distance' Measurement mode. Possible values are 'distance' or 'area'.
color String '#FF0080' The color of the lines or polygons.

Methods

Method Returns Description
setModel(<String> model) this Sets the measurement mode. Possible values are 'distance' or 'area'.

Customize Language

L.Measure = {
    linearMeasurement: "Distance measurement",
    areaMeasurement: "Area measurement",
    start: "Start",
    meter: "m",
    meterDecimals: 0,
    kilometer: "km",
    kilometerDecimals: 2,
    squareMeter: "m²",
    squareMeterDecimals: 0,
    squareKilometers: "km²",
    squareKilometersDecimals: 2
};

leaflet.measure's People

Contributors

ptma avatar ovidiu-pacurar avatar manuelhu avatar anvimaa 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.