var iconSize = [ 30, 30 ]; // size of the icon var iconAnchor = [ 15, 15 ]; // point of the icon which will correspond // to marker's location var popupAnchor = [ 0, -10 ]; // point from which the popup should open // relative to the iconAnchor var typeIcon = function(type) { return L.icon({ iconUrl : '/img/marker/' + type + '.png', iconSize : iconSize, iconAnchor : iconAnchor, popupAnchor : popupAnchor }); } var typeLegend = function(icon, title) { console.log(icon, title); return "" + title + ""; }