Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: query & display Flood Risk Zones in PlanningConstraints #2302

Merged
merged 2 commits into from
Oct 13, 2023
Merged
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
15 changes: 15 additions & 0 deletions api.planx.uk/gis/digitalLand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ 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

Expand Down
21 changes: 5 additions & 16 deletions api.planx.uk/gis/local_authorities/metadata/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const CATEGORY_COLORS: Record<string, string> = {
"Heritage and conservation": "#EDDCD2",
Ecology: "#E0EFCC",
Trees: "#DBE7E4",
Flooding: "#ECECEC",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open to better suggestions than grey here! Easy to adjust later though.

};

interface StyledConstraintProps extends BoxProps {
Expand Down
Loading