Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/components/dashboard_basemap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@
const normalizeMwsFeatures = (features) => {
if (!features) return [];

// already OL features
// already OL features (array)
if (
Array.isArray(features) &&
features.length &&
Expand All @@ -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 [];
};

Expand Down
7 changes: 6 additions & 1 deletion src/components/water_project_dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down