Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am adding markers to the map as below:

var markers = new L.LayerGroup();
L.marker([Latitude], [Longitude]).bindPopup("Hi there").addTo(markers);
map.addLayer(markers);

I have my own marker icons.Can someone tell me how to add those icons rather than default.....

share|improve this question
1  
Downvote: I am not a fan of answering with “read the docs”, but there is a limit to draw somewhere. –  MattiSG Oct 25 '12 at 19:40
add comment

1 Answer

up vote 2 down vote accepted
var markers = new L.LayerGroup();   
 var myIcon = L.icon({ 
        iconUrl: 'my-icon.png', // pull out values as desired from the feature feature.properties.style.externalGraphic.
        iconSize: [38, 95],
        iconAnchor: [22, 94],
        popupAnchor: [-3, -76],
        shadowUrl: 'my-icon-shadow.png',
        shadowSize: [68, 95],
        shadowAnchor: [22, 94]
    });

    marker = L.marker([50.505, 30.57], {icon: myIcon}).bindPopup("Hi there").addTo(markers);;
map.addLayer(markers);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.