filipstachura / react-leaflet-draw

React component for leaflet-draw

Home Page:http://tracemap.alexrieux.fr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React-Leaflet-Draw

React component build on top of React-Leaflet that integrate leaflet-draw functionality.

Install

npm install react-leaflet-draw

Getting started

It's important to wrap EditControl component into FeatureGroup component from react-leaflet. The drawed elements will be append in this FeatureGroup layer and edit button will edit only items in this layer.

import { Map, TileLayer, FeatureGroup } from 'react-leaflet';
import { EditControl } from "react-leaflet-draw"

...

<FeatureGroup>
    <EditControl position='topright' onEdit={this._onEditPath} onCreate={this._onCreate} draw={{
      rectangle: false
    }} />
</FeatureGroup>

For more details on how to use this plugin check the example.

You can pass more options on draw object, this informations can be found here

About

React component for leaflet-draw

http://tracemap.alexrieux.fr


Languages

Language:JavaScript 91.5%Language:HTML 8.5%