Skip to content

Commit

Permalink
query & display flood zones
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Oct 12, 2023
1 parent f2ec92f commit 118d4ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
10 changes: 10 additions & 0 deletions api.planx.uk/gis/digitalLand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

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",
};

interface StyledConstraintProps extends BoxProps {
Expand Down

0 comments on commit 118d4ed

Please sign in to comment.