diff --git a/WebGISPovertyMapping/assets/css/style.css b/WebGISPovertyMapping/assets/css/style.css index c89b3d7..70291e8 100644 --- a/WebGISPovertyMapping/assets/css/style.css +++ b/WebGISPovertyMapping/assets/css/style.css @@ -289,4 +289,42 @@ html, body { box-shadow: 0 2px 12px rgba(0,0,0,0.12) !important; font-family: 'Segoe UI', Arial, sans-serif !important; font-size: 13px !important; +} + +.map-legend { + background: white; + padding: 14px 16px; + border-radius: 10px; + box-shadow: 0 2px 12px rgba(0,0,0,0.12); + font-size: 13px; + font-family: 'Segoe UI', sans-serif; + min-width: 190px; +} +.map-legend h4 { + margin: 0 0 10px 0; + font-size: 13px; + font-weight: 700; + color: #1B2A4A; +} +.legend-item { + display: flex; + align-items: center; + gap: 8px; + margin-bottom: 6px; + color: #444; +} +.legend-dot { + width: 12px; + height: 12px; + border-radius: 50%; + display: inline-block; + flex-shrink: 0; +} +.legend-radius { + width: 18px; + height: 10px; + border: 2px dashed #8e44ad; + border-radius: 50%; + display: inline-block; + flex-shrink: 0; } \ No newline at end of file diff --git a/WebGISPovertyMapping/assets/js/script.js b/WebGISPovertyMapping/assets/js/script.js index 4f0cca7..dda6241 100644 --- a/WebGISPovertyMapping/assets/js/script.js +++ b/WebGISPovertyMapping/assets/js/script.js @@ -6,17 +6,42 @@ const popup = L.popup(); const daftarMarker = {}, daftarPolyline = {}, daftarPolygon = {}; // 1. BUAT KERTAS TRANSPARAN (LAYER GROUPS) -const layerPrasejahtera = L.layerGroup().addTo(map); -const layerIbadah = L.layerGroup().addTo(map); +const layerTercakup = L.layerGroup().addTo(map); +const layerTidakTercakup = L.layerGroup().addTo(map); +const layerIbadah = L.layerGroup().addTo(map); +const layerRadius = L.layerGroup().addTo(map); // 2. DAFTARKAN LAYER-LAYER TERSEBUT KE DALAM CONTROL PANEL const overlays = { - " Rumah Prasejahtera": layerPrasejahtera, + "⌂ Prasejahtera Tercakup": layerTercakup, + "⌂ Prasejahtera Tidak Tercakup": layerTidakTercakup, " Rumah Ibadah": layerIbadah, + "○ Radius Jangkauan": layerRadius, }; - -// 3. MUNCULKAN KONTROL DI POJOK KANAN ATAS PETA L.control.layers(null, overlays, { collapsed: false }).addTo(map); +let legend = L.control({ position: 'topright' }); +legend.onAdd = function() { + let div = L.DomUtil.create('div', 'map-legend'); + div.innerHTML = ` +