React component of leaflet-draw for react-leaflet

Overview

React Leaflet Draft

A modern study React component of leaflet draw for react-leaflet

React component of leaflet-draw for react-leaflet

React leaflet Draft

Table of contents

Main

dist/
└── index.min.js    

Getting started

Requirements

yarn add leaflet leaflet-draw react-leaflet

Installation

yarn add react-leaflet-draft

Usage

Basic Example

<FeatureGroup>
    <DraftControl/>
</FeatureGroup>

Full Example

) }">
import { DraftControl } from "react-leaflet-draft";
import { MapContainer, TileLayer, Marker, FeatureGroup } from "react-leaflet";

function Map() {
    return(
        <MapContainer
            zoom={14}
            center={position}
        >
            <TileLayer
                url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
            />
            <FeatureGroup>
                <DraftControl />
            </FeatureGroup>
        </MapContainer>
    )
}

API

You can see the properties in Leaflet-draw Documentation

Example options

<DraftControl
    draw={{
        circle: true,
        rectangle: true
    }}
    edit={{
        edit: false
    }}
    limitLayers={2}
/>

Example listeners

<DraftControl
    onEdited={e => console.log(e)}
    onDeleted={e => console.log(e)}
    onCreated={e => console.log(e)}
/>

License

ISC © Giovane Santos

You might also like...
React Component Library for Mapbox GL JS
React Component Library for Mapbox GL JS

Urbica React Mapbox GL JS React Component Library for Mapbox GL JS. Mapbox GL JS is a JavaScript library that renders interactive maps from vector til

Google street view component for React.js

Simple React.js component for Google Street View

React component for Nepal Map
React component for Nepal Map

React component for Nepal Map

React wrapper for mapbox-gl-geocoder for use with react-map-gl
React wrapper for mapbox-gl-geocoder for use with react-map-gl

react-map-gl-geocoder React wrapper for mapbox-gl-geocoder for use with react-map-gl. Demos Simple Example - https://codesandbox.io/s/l7p179qr6m Ignor

React wrapper for goong-geocoder for use with goong-map-react
React wrapper for goong-geocoder for use with goong-map-react

@goongmaps/goong-geocoder-reat React wrapper for @goongmaps/goong-geocoder for use with @goongmaps/goong-map-react Demo https://codesandbox.io/s/goong

Cross platform map for react & react-native 🗺

@teovilla/react-native-web-maps Cross platfrom maps for react & react-native Installation $ yarn add @teovilla/react-native-web-maps Usage with Expo w

A declarative React interface to Google Maps

React Google Maps A declarative React interface to Google Maps. Check it out: Example usage API docs What's new Important Notes This is an alpha relea

React friendly API wrapper around MapboxGL JS

react-map-gl | Docs react-map-gl is a suite of React components designed to provide a React API for Mapbox GL JS-compatible libraries. More informatio

Google map library for react that allows rendering components as markers :tada:

Google Map React · google-map-react is a component written over a small set of the Google Maps API. It allows you to render any React component on the

Comments
  • Repo's value proposal?

    Repo's value proposal?

    I'm wondering what would be the difference on using the classic github.com/alex3165/react-leaflet-draw and using yours package.

    Does this solves the unupdated states for polygons from alex3165?

    opened by CxrlosKenobi 2
  • using other useEffect will cause multiple call of event handlers like onCreated

    using other useEffect will cause multiple call of event handlers like onCreated

    I am using websockets using useEffect and also one useEffect for load some markers, polylines and also shapes into map when compoent mounts. When DraftControl call onCreated, it calls it 5 times in my case. When I comment out my useEffects, then it is working as expected. The same happens for other event handlers as well.

    I also tried to wrap it to parent component which has useEffect hooks and send props into child component with only mapContainer and DraftControl but it did not help. Is there any solution for that?

    I need websockets and also I need data on load.

    Thanks.

    opened by tomcosk 1
Releases(v1.1.0)
  • v1.1.0(Jul 18, 2022)

  • v1.0.0(Feb 15, 2022)

    Realease 1.0.0 (February 15, 2022)

    Implemented

    • prop limitLayer for control layes in map
    • compatibility with react-leflet v3
    • More performance and modularity
    Source code(tar.gz)
    Source code(zip)
Owner
Giovane Santos Silva
Front-end architect, engineer.
Giovane Santos Silva
React-leaflet control for resetting the map view

react-leaflet-resetview react-leaflet control for resetting the map view Installation You can install react-leaflet-resetview with NPM: npm i @20tab/r

20tab srl 2 Apr 22, 2022
A react-leaflet & express app for visualizing the latest earthquake data from Kandilli Observatory

Earthquake Tracker Turkey A react-leaflet & express app for visualizing the latest earthquake data from Kandilli Observatory. Tech Stack Client: React

Coşkun Atak 3 Sep 30, 2022
A step by step guide to set up a basic Leaflet map in a React project.

Setting up a basic leaflets.js map in React View Project This demo project has been built with Create-React-App environment. Check it out on CodeSandb

Aija Avota 7 Oct 20, 2022
react-maps - A map component for React

Maps for React A map component for React, the declarative UI library. Allow your React sites to use Google Maps easily. Example In the render-function

Matti Nelimarkka 44 Feb 17, 2022
React.js Google Maps integration component

react-google-maps React.js Google Maps integration component Introduction Installation Usage & Configuration Changelog The changelog is automatically

Tom Chen 4.5k Dec 24, 2022
A Google Maps component for React.js

React Gmaps A Google Maps component for React.js Features Lazy Google Maps loading Easy to use Installation $ npm install react-gmaps --save Demo http

Michele Bertoli 314 Nov 13, 2022
Companion code to the "How to Write a Google Maps React Component" Tutorial

Google Map React Component Tutorial A declarative Google Map React component using React, lazy-loading dependencies, current-location finder and a tes

Fullstack React 1.6k Jan 2, 2023
🗺 A React component for interactive vector maps of the world and 100+ countries

react-vector-maps ??️ A React component for interactive vector maps of the world and 100+ countries Features Simple and easy to implement React compon

Alex Gabites 123 Dec 17, 2022
Extensible React Component for Taipei Metro Map

react-taipei-metro Extensible React Component for SVG Taipei Metro Map

Li-Wei Wang 7 Nov 11, 2022
React component Maps API 2GIS

React component Maps API 2GIS

2GIS 20 Mar 9, 2022