(Last Updated On: )
In this tutorial I will demonstrate how to add a easy button to your leaflet map. This will just be a basic example. For more information refer to the documentation.
Before We Begin:
- Refer to how to Build a React/Python Site to get your basic site up and running.
- Refer to Basic Leaflet Map to get your basic leaflet control up and running.
Node Package Install:
npm install leaflet-easybutton --save
Edit app/home/leaflet/js/map.jsx:
//Add the leaflet easybutton package require("leaflet-easybutton"); require("leaflet-easybutton/src/easy-button.css"); //Somehwere on your page add the following. //Check out https://github.com/CliffCloud/Leaflet.EasyButton for more uses L.easyButton("<div id="tag" class="glyphicon glyphicon-tag" />", function(btn, map) { map.setView([42.3748204,-71.1161913],16); }, { position: "topleft"}).addTo(this.map);