I'm having trouble with installing Leaflet.draw plugin. I've spent several hours trying to figure out how to install it, but failed. Can someone please explain to me how can I use it?
To use the Leaflet.draw plugin, you need to add the js and css files to your html header, like so:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- Leaflet stylesheets/javascript -->
<link rel="stylesheet" href="leaflet.css" />
<script src="leaflet.js"></script>
<!-- Leaflet.draw main plug in files -->
<link rel="stylesheet" href="files/leaflet.draw.css" /> <!--add here-->
<script src="files/Leaflet.draw.js"></script> <!--and here-->
</head>
<body>
[...]
I keep my Leaflet.draw organized inside a files
directory.
This official example Leaflet.draw webpage might come in handy. Note that they add each plug-in piece individually, but you only need to add the main source code files Leaflet.draw.js
and leaflet.draw.css
.
To install using npm:
npm install leaflet-draw
For saving in package.json:
npm install leaflet-draw --save
For global installation:
npm install -g leaflet-draw
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With