I'm facing a weird issue while adding markers with custom icons to my map. Basically I'm trying to show polylines in red color and mark the waypoints with the custom icons with a popup connecting the media information. When the default marker is added, the track appears as in the attachment, default_marker.png. All the points looks connected. But when custom icons are added, the marker position is changed. Refer attachment, custom_markers.png. I'm not sure where I'm going wrong. Below are the code snippets.
var addedTrack = L.geoJson(track, {
style: function(feature) {
return {
color: 'red',
};
},
pointToLayer: function(feature,latlng){
case 'Picture':
return L.marker(latlng, {icon:pictureIcon});
case 'Voice recording':
return L.marker(latlng,{icon:audioIcon});
default:
return L.marker(latlng,{icon:textIcon});
}
},
onEachFeature: function(feature, layer) {
case 'Picture':
layer.bindPopup("<img class='img-responsive' src=" + obj.get('data-path') + '/' +
feature.properties.link + "/>");
break;
case 'Voice recording':
layer.bindPopup("<audio controls='controls' src=" + obj.get('data-path')+ '/' +
feature.properties.link + ".mp3" + "/>");
break;
default:
break;
}
}
}).addTo(map);
Thank you for any help.