I am working on map control app using leaflet plugin ....

I added a custom button for marker in side toolbar....


I want to put marker on map when i click on that button....in other words i want to enable marker control when i click on this button


I am trying to bind the marker events with that button and as usual i face failure in doing that,,,,(please consider i am using the poly area functions but want to keep markers separate)

In script :

    var greenIcon = L.icon({
        iconUrl: 'assets/img/marker-icon.png',
        shadowUrl: 'assets/img/marker-shadow.png',
    map.on('click', putMarker);
    function putMarker(e) {
        L.marker(e.latlng, { icon: greenIcon }).addTo(map);
    //custom button for marker
    L.easyButton('glyphicon-facetime-video', function () {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.