Plugins - Draw
So far, we've made maps for displaying information, but what about gathering information from the user? With the Leaflet.Draw plugin, we can allow our users to draw shapes on a map to be collected as form inputs or for other purposes.
index.html
Remember, to use a plugin, we must include the files we need in the head section of our html file.
map.js
Using this plugin is a little more complicated than the ones we've done so far. We have to add a custom control to the map as well as listen for events on the map for when a draw event has happened.
Result
Let's take a look at the result here.