diff --git a/api.planx.uk/gis/digitalLand.ts b/api.planx.uk/gis/digitalLand.ts index bdde071a26..a7295ee865 100644 --- a/api.planx.uk/gis/digitalLand.ts +++ b/api.planx.uk/gis/digitalLand.ts @@ -169,6 +169,16 @@ async function go( formattedResult[broads] = { fn: broads, value: false }; } + // FLOODING + if (formattedResult["flood"] && formattedResult["flood"].value) { + ["flood.zone.1", "flood.zone.2", "flood.zone.3"].forEach((zone) => + formattedResult[zone] = { + fn: zone, + value: Boolean(formattedResult["flood"].data?.filter((entity) => entity["flood-risk-level"] === zone.split(".").pop()).length), + }, + ); + } + // --- LISTED BUILDINGS --- // TODO add granular variables to reflect grade (eg `listed.grade1`), not reflected in content yet though diff --git a/api.planx.uk/gis/local_authorities/metadata/base.ts b/api.planx.uk/gis/local_authorities/metadata/base.ts index d078296d13..f5f8c053c3 100644 --- a/api.planx.uk/gis/local_authorities/metadata/base.ts +++ b/api.planx.uk/gis/local_authorities/metadata/base.ts @@ -133,22 +133,11 @@ const baseSchema: PlanningConstraintsBaseSchema = { "digital-land-datasets": ["ancient-woodland"], category: "Ecology", }, - "flood.zone1": { - active: false, - neg: "is not within a Flood Zone 1 (low risk)", - pos: "is within a Flood Zone 1 (low risk)", - category: "Flooding", - }, - "flood.zone2": { - active: false, - neg: "is not within a Flood Zone 2 (medium risk)", - pos: "is within a Flood Zone 2 (medium risk)", - category: "Flooding", - }, - "flood.zone3": { - active: false, - neg: "is not within a Flood Zone 3 (high risk)", - pos: "is within a Flood Zone 3 (high risk)", + "flood": { + active: true, + neg: "is not in a Flood Risk Zone", + pos: "is in a Flood Risk Zone", + "digital-land-datasets": ["flood-risk-zone"], category: "Flooding", }, "defence.explosives": { diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/List.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/List.tsx index 70f4ea2dcc..c868403c19 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/List.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/List.tsx @@ -23,6 +23,7 @@ const CATEGORY_COLORS: Record = { "Heritage and conservation": "#EDDCD2", Ecology: "#E0EFCC", Trees: "#DBE7E4", + Flooding: "#ECECEC", }; interface StyledConstraintProps extends BoxProps {