{"id":13912663,"url":"https://github.com/alex3165/react-leaflet-draw","last_synced_at":"2025-04-11T23:20:04.153Z","repository":{"id":38949090,"uuid":"48446032","full_name":"alex3165/react-leaflet-draw","owner":"alex3165","description":"React component for leaflet-draw on top of react-leaflet","archived":false,"fork":false,"pushed_at":"2025-02-04T18:18:21.000Z","size":918,"stargazers_count":238,"open_issues_count":65,"forks_count":154,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-11T23:19:51.270Z","etag":null,"topics":["leaflet-draw","map","react","react-leaflet","react-leaflet-draw"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alex3165.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-12-22T17:48:35.000Z","updated_at":"2025-04-10T03:29:09.000Z","dependencies_parsed_at":"2024-01-14T08:48:00.884Z","dependency_job_id":"12d9347c-ee59-4bdf-a3df-a10226dd898b","html_url":"https://github.com/alex3165/react-leaflet-draw","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex3165%2Freact-leaflet-draw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex3165%2Freact-leaflet-draw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex3165%2Freact-leaflet-draw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex3165%2Freact-leaflet-draw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alex3165","download_url":"https://codeload.github.com/alex3165/react-leaflet-draw/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492919,"owners_count":21113166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["leaflet-draw","map","react","react-leaflet","react-leaflet-draw"],"created_at":"2024-08-07T01:01:39.854Z","updated_at":"2025-04-11T23:20:04.128Z","avatar_url":"https://github.com/alex3165.png","language":"JavaScript","funding_links":[],"categories":["react"],"sub_categories":[],"readme":"# React-Leaflet-Draw\n\nReact component build on top of [React-Leaflet](https://github.com/PaulLeCam/react-leaflet) that integrate [leaflet-draw](https://github.com/Leaflet/Leaflet.draw) feature.\n\n## Install\n\n```\nnpm install react-leaflet-draw\n```\n\n## Getting started\n\nFirst, include leaflet \u0026 leaflet-draw styles in your project\n```html\n\u003clink rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.css\"/\u003e\n\u003clink rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.css\"/\u003e\n```\nor by including\n```\nnode_modules/leaflet/dist/leaflet.css\nnode_modules/leaflet-draw/dist/leaflet.draw.css\n```\n\nYou might need to add one more rule missing in the current css:\n```css\n  .sr-only {\n    display: none;\n  }\n```\n\nIt's important to wrap EditControl component into FeatureGroup component from `react-leaflet`.\nThe elements you draw will be added to this FeatureGroup layer, when you hit edit button only items in this layer will be edited.\n\n```jsx\nimport { Map, TileLayer, FeatureGroup, Circle } from 'react-leaflet';\nimport { EditControl } from \"react-leaflet-draw\"\n\nconst Component = () =\u003e (\n  \u003cFeatureGroup\u003e\n    \u003cEditControl\n      position='topright'\n      onEdited={this._onEditPath}\n      onCreated={this._onCreate}\n      onDeleted={this._onDeleted}\n      draw={{\n        rectangle: false\n      }}\n    /\u003e\n    \u003cCircle center={[51.51, -0.06]} radius={200} /\u003e\n  \u003c/FeatureGroup\u003e\n);\n```\n\nFor more details on how to use this plugin check out the examples [example](examples).\n- `yarn example:class` to compile the class example\n- `yarn example:hooks` to compile and run the hooks example\n\nYou can pass more options on draw object, this informations can be found [here](https://github.com/Leaflet/Leaflet.draw#user-content-example-leafletdraw-config)\n\n## EditControl API\n\n#### Props\n\n|name            |type                        |description                                           |\n|----------------|----------------------------|------------------------------------------------------|\n|position        |string                      |control group position                                |\n|draw            |object \u003cDrawOptions\u003e        |enable/disable draw controls                          |\n|edit            |object \u003cEditPolyOptions\u003e    |enable/disable edit controls                          |\n|onEdited        |function                    |hook to leaflet-draw's `draw:edited` event            |\n|onCreated       |function                    |hook to leaflet-draw's `draw:created` event           |\n|onDeleted       |function                    |hook to leaflet-draw's `draw:deleted` event           |\n|onMounted       |function                    |hook to leaflet-draw's `draw:mounted` event           |\n|onEditStart     |function                    |hook to leaflet-draw's `draw:editstart` event         |\n|onEditStop      |function                    |hook to leaflet-draw's `draw:editstop` event          |\n|onDeleteStart   |function                    |hook to leaflet-draw's `draw:deletestart` event       |\n|onDeleteStop    |function                    |hook to leaflet-draw's `draw:deletestop` event        |\n|onDrawStart     |function                    |hook to leaflet-draw's `draw:drawstart` event         |\n|onDrawStop      |function                    |hook to leaflet-draw's `draw:drawstop` event          |\n|onDrawVertex    |function                    |hook to leaflet-draw's `draw:drawvertex` event        |\n|onEditMove      |function                    |hook to leaflet-draw's `draw:editmove` event          |\n|onEditResize    |function                    |hook to leaflet-draw's `draw:editresize` event          |\n|onEditVertex    |function                    |hook to leaflet-draw's `draw:editvertex` event          |\n\n#### Links to docs\n\n* [Control position options](http://leafletjs.com/reference.html#control-positions)\n* [DrawOptions](https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html#drawoptions)\n* [EditPolyOptions](https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html#editpolyoptions)\n* [Draw events](https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html#l-draw-event)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex3165%2Freact-leaflet-draw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex3165%2Freact-leaflet-draw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex3165%2Freact-leaflet-draw/lists"}