Tell me more ×
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 using Leaflet.js and MapQuest maps; added base layer and added more than one layer using L.LayerGroup() after adding those layers using map.addLayer(LayerGroup); trying to add Legend for individual crated layer group but only way I know and understand so is var legend = L.control({ position: 'bottomright' });

legend.onAdd = function (map) { var div = L.DomUtil.create('div', 'legend'), grades = [0, 10, 20, 50, 100], labels = [], from, to;

    for (var i = 0; i < grades.length; i++) {
        from = grades[i];
        to = grades[i + 1];

        labels.push(
                    '<i style="background:' + getColor(from + 1) + '"></i> ' +
                    from + (to ? '&ndash;' + to : '+'));
    }

    div.innerHTML = labels.join('<br/>');
    return div;
};

After creating add legend... legend.addTo(map);

I want to add more than one Legend for individual Layer I have created. Please help, how can I add and manage legend for individual layer.

Thanks Raj

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.