# leaflet-plot

> A Leaflet Plugin For Plot in Leaflet 1.0

Latest version **1.0.5** (published 2024-03-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install leaflet-plot
pnpm add leaflet-plot
yarn add leaflet-plot
bun add leaflet-plot
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2024-03-07 |
| First published | 2021-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ShengLin Liang |
| Maintainers | liangshenglin |
| Keywords | leaflet, map plot, map overlay, leaflet-draw, leaflet-plot, ui-leaflet-draw |

## Links

- npm: https://www.npmjs.com/package/leaflet-plot
- npm.io page: https://npm.io/package/leaflet-plot

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [post-robot](https://npm.io/package/post-robot.md) — 93.7K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads

## Recent versions

- 1.0.5 (latest) — 2024-03-07
- 1.0.4 — 2023-08-24
- 1.0.3 — 2021-07-19
- 1.0.2 — 2021-07-19
- 1.0.1 — 2021-07-13
- 1.0.0 — 2021-06-15

## README

# leaflet-plot

[![NPM Version][npm-image]][npm-url]

![](MDbackground.png)

### Installation

#### Install via npm

```
npm i leaflet-plot
```

#### Install Manually

Download
[`leaflet-plot.css`](https://unpkg.com/leaflet-plot@1.0.4/dist/leaflet-plot.css) and
[`leaflet-plot.min.js`](https://unpkg.com/leaflet-plot@1.0.4/dist/leaflet-plot.min.js)
and include them in your project.

#### Include via CDN

CSS

<!-- prettier-ignore -->
```html

<link rel="stylesheet" href="https://unpkg.com/leaflet-plot@1.0.4/dist/leaflet-plot.css" />
```

JS

```html
<script src="https://unpkg.com/leaflet-plot@1.0.4/dist/leaflet-plot.min.js"></script>
```

#### Include as ES6 Module

```js
import 'leaflet-plot';
import 'leaflet-plot/dist/leaflet-plot.css';
```

### Getting Started

Currently available shapes are `StraightArrow`, `RightAngleArrow`, `TailedArrow`, `DoubleArrow`.


### Create function

Use Create function on a map like this
```js
// StraightArrow create function
const arrowLayer = window.L.SL.Create.StraightArrow(latlngs, options)

```
##### See the available options.
latlngs: Array<Array<string>>

options: [leaflet path options](https://leafletjs.com/reference-1.4.0.html#path)

### Drawing Mode

Use Drawing Mode on a map like this

```js
// enable StraightArrow drawing mode
map.sl.enableDraw('StraightArrow', options);

// disable drawing mode
map.sl.disableDraw();
```
##### See the available options.

options: [leaflet path options](https://leafletjs.com/reference-1.4.0.html#path)

##### You can listen to map events to hook into the drawing procedure like this:

```js
map.on('sl:create', e => {
  console.log(e);
});
```

| Event        | Params | Description                                                                            |
| :----------- | :----- | :------------------------------------------------------------------------------------- |
| sl:create    | `e`    | Called when a shape is drawn/finished. Payload includes shape type and the drawn layer |

### Edit Mode

Let's you edit vertices of layers. Use it like this:

```js
// enable edit mode
layer.sl.enable();
```

##### You can listen to map events to hook into the drawing procedure like this:

```js
map.on('sl:edit', e => {
  console.log(e);
});
```

| Event        | Params | Description                                                                            |
| :----------- | :----- | :------------------------------------------------------------------------------------- |
| sl:edit            | `e`    | Fired when a layer is edited.                                                                        |

<!-- Markdown link & img dfn's -->
[npm-image]: https://img.shields.io/npm/v/leaflet-plot
[npm-url]: https://www.npmjs.com/package/leaflet-plot

---
_Source: https://npm.io/package/leaflet-plot · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
