0.0.14 • Published 3 months ago

maplibre-gl-measures v0.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

maplibre-gl-measures

maplibre-gl-measures

A MapLibre GL JS plugin for taking length measures with lines and area measures with polygons.

It's working with MapLibre GL JS inspired by the great work done by mapbox/mapbox-gl-draw

Demo

You can rush to the demo here.

Getting started

To use this plugin you need to run:

npm install --save maplibre-gl-measures

and then, in your code use it as follows:

// Import it into your code
import MeasuresControl from 'maplibre-gl-measures';

// your map logic here...

// add the plugin
map.addControl(new MeasuresControl({ /** see options below for further tunning */}), "top-left");

Options

You can control the appearance, units by using the following:

options = {
            lang: {
                areaMeasurementButtonTitle: 'Measure area',
                lengthMeasurementButtonTitle: 'Measure length',
                clearMeasurementsButtonTitle:  'Clear measurements',
            },
            units: 'imperial', //or metric, the default
            unitsGroupingSeparator: ' ', // optional. use a space instead of ',' for separating thousands (3 digits group). Do not send this to use the browser default
            style: {
                text: {
                    radialOffset:  0.9,
                    letterSpacing: 0.05,
                    color: '#D20C0C',
                    haloColor: '#fff',
                    haloWidth: 0,
                    font: 'Klokantech Noto Sans Bold',
                },
                common: {
                    midPointRadius: 3,
                    midPointColor: '#D20C0C',
                    midPointHaloRadius: 5,
                    midPointHaloColor: '#FFF',
                },
                areaMeasurement: {
                    fillColor: '#D20C0C',
                    fillOutlineColor: '#D20C0C',
                    fillOpacity: 0.01,
                    lineWidth: 2,
                },
                lengthMeasurement: {
                    lineWidth: 2,
                    lineColor: "#D20C0C",
                },
            }
        };

map.addControl(new MeasuresControl(options));

Supported Versions

MapLibre GL JS 2.4 and later versions should be supported. Earlier versions probably won\'t work (not even tested anymore).


Contributing

Any contributions to this project are more than welcome. Feel free to reach us and we will gladly include any improvements or ideas that you may have. Please, fork this repository, make any changes and submit a Pull Request and we will get in touch!

Contributors

| Jorge Santos |:---:| | jdsantos | | github.com/jdsantos

Support

The easiest way to seek support is by submiting an issue on this repo.


0.0.11

3 months ago

0.0.12

3 months ago

0.0.13

3 months ago

0.0.14

3 months ago

0.0.10

3 months ago

0.0.9

3 months ago

0.0.8

3 months ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago