# leaflet-editable

> Make geometries editable in Leaflet

Latest version **1.3.2** (published 2025-07-28) · WTFPL license · 0 weekly downloads

## Install

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

## Health

**Score 33/100 (F)** — status: maintenance-mode.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.2 |
| Published | 2025-07-28 |
| First published | 2014-08-02 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | separate (@types/leaflet-editable) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 299.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 606 |
| Author | Yohan Boniface |
| Maintainers | ybon |
| Keywords | leaflet, map |

## Links

- npm: https://www.npmjs.com/package/leaflet-editable
- Repository: https://github.com/Leaflet/Leaflet.Editable
- Homepage: https://github.com/Leaflet/Leaflet.Editable/
- Issues: https://github.com/Leaflet/Leaflet.Editable/issues
- npm.io page: https://npm.io/package/leaflet-editable

## Recent versions

- 1.3.2 (latest) — 2025-07-28
- 1.3.1 — 2025-02-27
- 1.3.0 — 2024-09-06
- 1.2.0 — 2018-09-05
- 1.1.0 — 2017-08-09
- 1.0.0 — 2016-11-05
- 1.0.0-rc.2 — 2016-09-10
- 1.0.0-rc.1 — 2016-04-25
- 0.7.0-beta.1 — 2015-10-15
- 0.6.2 — 2015-04-17
- 0.6.1 — 2014-11-09
- 0.6.0 — 2014-10-05
- 0.5.0 — 2014-08-27
- 0.4.0 — 2014-08-25
- 0.3.0 — 2014-08-07
- … 2 more at https://npm.io/package/leaflet-editable/versions

## README

[![Build Status](https://travis-ci.org/Leaflet/Leaflet.Editable.svg?branch=master)](https://travis-ci.org/Leaflet/Leaflet.Editable)
# Leaflet.Editable

Make geometries editable in Leaflet.


This is not a plug and play UI, and will not be. This is a minimal, lightweight,
and fully extendable API to control editing of geometries. So you can easily
build your own UI with your own needs and choices.

See the [demo UI](http://Leaflet.github.io/Leaflet.Editable/example/index.html), an more [examples below](#examples).
This is also the drawing engine behind [uMap](http://wiki.openstreetmap.org/wiki/UMap).


Design keys:

- only the core needs
- no UI, instead hooks everywhere needed
- everything programmatically controllable
- MultiPolygon/MultiPolyline support
- Polygons' holes support
- touch support
- tests

## Install

You need Leaflet >= 1.0.0, and then include `src/Leaflet.Editable.js`.

### Path dragging

If you want path dragging, you need to also include [Path.Drag.js](https://github.com/Leaflet/Path.Drag.js).


## Quick start

Allow Leaflet.Editable in the map options:

    var map = L.map('map', {editable: true});

Then, to start editing an existing feature, call the `enableEdit` method on it:

    var polyline = L.polyline([[43.1, 1.2], [43.2, 1.3],[43.3, 1.2]]).addTo(map);
    polyline.enableEdit();

If you want to draw a new line:

    map.editTools.startPolyline();  // map.editTools has been created
                                    // by passing editable: true option to the map

If you want to continue an existing line:

    polyline.editor.continueForward();
    // or
    polyline.editor.continueBackward();

## Examples

- [Basic controls](http://Leaflet.github.io/Leaflet.Editable/example/index.html)
- [Continue line by ctrl/command-clicking on first/last point](http://Leaflet.github.io/Leaflet.Editable/example/continue-line.html)
- [Create hole in a polygon by ctrl-clicking on it](http://Leaflet.github.io/Leaflet.Editable/example/create-hole-on-click.html)
- [Change line colour on editing](http://Leaflet.github.io/Leaflet.Editable/example/change-line-colour-on-editing.html)
- [Display a tooltip near cursor while drawing](http://Leaflet.github.io/Leaflet.Editable/example/tooltip-when-drawing.html)
- [Basic demo of undo/redo](http://Leaflet.github.io/Leaflet.Editable/example/undo-redo.html) (Use ctrl-Z to undo and ctrl-shift-Z to redo)
- [Deleting shapes by ctrl/command clicking on it](http://Leaflet.github.io/Leaflet.Editable/example/delete-shape.html)
- [Multipolygon example](http://Leaflet.github.io/Leaflet.Editable/example/multipolygon.html)
- Example of [Leaflet.Snap](https://github.com/makinacorpus/Leaflet.Snap/) integration [to enable snapping](http://Leaflet.github.io/Leaflet.Editable/example/snapping.html)


## API

[See the reference](http://Leaflet.github.io/Leaflet.Editable/doc/api.html)


## Licence

`Leaflet.Editable` is released under the WTFPL licence.

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