Skip to content

Commit

Permalink
fix missing gsp Polygons in map data
Browse files Browse the repository at this point in the history
  • Loading branch information
braddf committed Nov 22, 2024
1 parent 221d5d1 commit d443516
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions apps/nowcasting-app/components/helpers/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ const mapZoneFeatures: (
let zoneInstalledCapacity = 0;
// Loop through all the GSP IDs in the zone and aggregate the forecast and actuals
gsps.forEach((gsp) => {
gspCoords = [
...gspCoords,
...(gspShapeData.features[gsp - 1].geometry.coordinates as Position[][][])
];
const gspShape = gspShapeData.features[gsp - 1];
if (gspShape.geometry.type === "Polygon") {
gspCoords = [...gspCoords, gspShape.geometry.coordinates as Position[][]];
}
if (gspShape.geometry.type === "MultiPolygon") {
gspCoords = [...gspCoords, ...(gspShape.geometry.coordinates as Position[][][])];
}
zoneForecastTotal +=
gspForecastsDataByTimestamp.find(
(fc) => fc.datetimeUtc.slice(0, 16) === formatISODateString(targetTime)
Expand Down

0 comments on commit d443516

Please sign in to comment.