AISAC
AISAC

Reputation: 931

leaflet.js marker-icon-2x and marker-shadow.png not loading

is it possible to use a custom icon on my Leaflet map? I tried to do something like :

   function onLocationFound(e) {
        var radius = e.accuracy / 2;

        var customIcon = L.icon({
          iconUrl: 'images/marker_icon_2x.png',
          shadowUrl: 'images/marker_shadow.png'
        });    
        L.marker(e.latlng).addTo(map)
            .bindPopup("You are within " + radius + " meters from this point").openPopup();

        L.circle(e.latlng, radius).addTo(map);
    }

but I did not work, does anyone know the best way to do it? the icon appears with the wrong size and also in another position

Upvotes: 1

Views: 3663

Answers (0)

Related Questions