From 5a819ee3b50786c9aabb38c222bc8e0e6c7073e6 Mon Sep 17 00:00:00 2001 From: Ksheetiz Agrahari Date: Fri, 28 Aug 2026 22:00:29 +0530 Subject: [PATCH] Fix : Fixed the waterbodies boundaries not visible --- templates/mws-report.html | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/templates/mws-report.html b/templates/mws-report.html index 83a3c572..2cb71927 100644 --- a/templates/mws-report.html +++ b/templates/mws-report.html @@ -3404,7 +3404,7 @@

MGNREGA works

source: new ol.source.ImageWMS({ url: 'https://geoserver.core-stack.org:8443/geoserver/wms', params: { - 'LAYERS': "LULC_level_3:LULC_22_23_{{district}}_{{block}}_level_3", + 'LAYERS': "LULC_level_3:LULC_24_25_{{district}}_{{block}}_level_3", 'STYLES': "lulc_water_pixels" }, ratio: 1, @@ -4198,19 +4198,15 @@

MGNREGA works

// FETCH SURFACE WATERBODIES // ============================================================================ - fetch("https://geoserver.core-stack.org:8443/geoserver/swb/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=swb:surface_waterbodies_{{district}}_{{block}}&outputFormat=application/json") - .then(response => response.json()) - .then(data => { - swbMap.addLayer(waterRaster); - }) - .catch(error => { - // Silently handle fetch errors - }); - // Waterbodies for this MWS, colored by type (river vs other), for the village maps - fetch(`https://geoserver.core-stack.org:8443/geoserver/swb/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=swb:surface_waterbodies_{{district}}_{{block}}&outputFormat=application/json&CQL_FILTER=MWS_UID='{{mws_id}}'`) - .then(response => response.json()) - .then(data => { + (async () => { + const typeName = `swb:surface_waterbodies_{{district}}_{{block}}`; + const url = `https://geoserver.core-stack.org:8443/geoserver/swb/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=${typeName}&outputFormat=application/json`; + + try { + const response = await fetch(url); + const data = await response.json(); + const waterbodyStyleFunction = feature => { const isRiver = (feature.get('waterbody_type') || '').toLowerCase() === 'river'; return new ol.style.Style({ @@ -4229,10 +4225,12 @@

MGNREGA works

}); swbMap.addLayer(new ol.layer.Vector({ source: swbVillageSource, style: waterbodyStyleFunction, zIndex: 4 })); - }) - .catch(error => { + swbMap.addLayer(waterRaster); + console.log(swbVillageSource) + } catch (error) { // Silently handle fetch errors - }); + } + })(); // ============================================================================ // FETCH GROUNDWATER EXTRACTION STATUS