Commit 90289944 authored by Rodrigo Tapia-McClung's avatar Rodrigo Tapia-McClung

Added map legend

parent eaef7387
......@@ -362,6 +362,7 @@ const populateMap = async (mapData) => {
duration: "P1Y"
});
timeLayer.addTo(map);
legend.addTo(map);
let baseLayers = {
"Carto Dark": cartoDarkLayer,
......@@ -521,6 +522,27 @@ L.timeDimension.layer.Tile = (layer, options) => {
return new L.TimeDimension.Layer.Tile(layer, options);
};
let legend = L.control({
position: "bottomright"
});
legend.onAdd = () => {
let div = L.DomUtil.create("div", "info legend leaflet-bar");
let html = "<h6>Urbanizaci&oacute;n</h6><ul>";
let colorGrados = {
"Baja": "rgb(49,149,54)",
"Media": "rgb(255,255,191)",
"Alta": "rgb(158,1,66)"
};
Object.keys(colorGrados).forEach( grado => {
html += `<li><i style="background: ${colorGrados[grado]}"></i>${grado}</li>`;
});
html += "</ul>";
div.innerHTML = html;
return div;
};
// hide initial screen and show map
$("#startHeader").remove();
$("#initial-backdrop").remove();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment