Leaflet marker/icon help
It looks strange that you add both a GeoJSON layer from result.geojson
and a marker created from [result.lat, result.lon]
.
If result.geojson
contains the same point information as [result.lat, result.lon]
, you are adding both markers to your map.
an event listener and change the icon through setIcon() method:
createdMarker.on("dblclick", function(evt) {
var myIcon = L.icon({
iconUrl: 'res/marker-icon-red.png',
shadowUrl: 'res/marker-shadow.png'
});
this.setIcon(myIcon);
});
Or you can get some help from this Tutorial