diff --git a/src/components/dashboard_basemap.jsx b/src/components/dashboard_basemap.jsx index de9bc77a..2c6d362c 100644 --- a/src/components/dashboard_basemap.jsx +++ b/src/components/dashboard_basemap.jsx @@ -1092,7 +1092,7 @@ const normalizeMwsFeatures = (features) => { if (!features) return []; - // already OL features + // already OL features (array) if ( Array.isArray(features) && features.length && @@ -1115,6 +1115,26 @@ ); } + // single OL feature → wrap in array + if (typeof features?.getGeometry === "function") { + return [features]; + } + + // single GeoJSON feature → wrap and read + if (features?.geometry) { + const read = geojsonReaderRef.current.readFeatures( + { + type: "FeatureCollection", + features: [{ type: "Feature", geometry: features.geometry, properties: features.properties || {} }], + }, + { + dataProjection: "EPSG:4326", + featureProjection: "EPSG:4326", + } + ); + return read || []; + } + return []; }; diff --git a/src/components/water_project_dashboard.jsx b/src/components/water_project_dashboard.jsx index 208285de..b23901d8 100644 --- a/src/components/water_project_dashboard.jsx +++ b/src/components/water_project_dashboard.jsx @@ -285,7 +285,12 @@ const WaterProjectDashboard = () => { ); }; - const mwsForMap = matchedMWSFeaturesProject; + // All matched MWS features for map (terrain/drainage cropped to full project area) + const mwsForMap = Array.isArray(matchedMWSFeaturesProject) + ? matchedMWSFeaturesProject + : matchedMWSFeaturesProject + ? [matchedMWSFeaturesProject] + : []; const mwsForCharts = useMemo(() => { return getFirstMwsWithValues(matchedMWSFeaturesProject);