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

Refactor layer code #353

Merged
merged 2 commits into from
Sep 25, 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
42 changes: 21 additions & 21 deletions src/lib/browse/LayerControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
} from "lib/common";
import { CheckboxGroup } from "lib/govuk";
import { interactiveMapLayersEnabled } from "stores";
import BusRoutesLayerControl from "./layers/BusRoutesLayerControl.svelte";
import CensusOutputAreaLayerControl from "./layers/CensusOutputAreaLayerControl.svelte";
import CombinedAuthoritiesLayerControl from "./layers/CombinedAuthoritiesLayerControl.svelte";
import CriticalIssuesLayerControl from "./layers/CriticalIssuesLayerControl.svelte";
import CrossingsLayerControl from "./layers/CrossingsLayerControl.svelte";
import CycleParkingLayerControl from "./layers/CycleParkingLayerControl.svelte";
import CyclePathsLayerControl from "./layers/CyclePathsLayerControl.svelte";
import HospitalsLayerControl from "./layers/HospitalsLayerControl.svelte";
import ImdLayerControl from "./layers/ImdLayerControl.svelte";
import LocalAuthorityDistrictsLayerControl from "./layers/LocalAuthorityDistrictsLayerControl.svelte";
import LocalPlanningAuthoritiesLayerControl from "./layers/LocalPlanningAuthoritiesLayerControl.svelte";
import MrnLayerControl from "./layers/MrnLayerControl.svelte";
import ParliamentaryConstituenciesLayerControl from "./layers/ParliamentaryConstituenciesLayerControl.svelte";
import PctLayerControl from "./layers/PctLayerControl.svelte";
import RailwayStationsLayerControl from "./layers/RailwayStationsLayerControl.svelte";
import RoadSpeedsLayerControl from "./layers/RoadSpeedsLayerControl.svelte";
import RoadWidthsLayerControl from "./layers/RoadWidthsLayerControl.svelte";
import SchoolsLayerControl from "./layers/SchoolsLayerControl.svelte";
import SportsSpacesLayerControl from "./layers/SportsSpacesLayerControl.svelte";
import VehicleCountsLayerControl from "./layers/VehicleCountsLayerControl.svelte";
import WardsLayerControl from "./layers/WardsLayerControl.svelte";
import CensusOutputAreaLayerControl from "./layers/areas/CensusOutputAreas.svelte";
import CombinedAuthoritiesLayerControl from "./layers/areas/CombinedAuthorities.svelte";
import ImdLayerControl from "./layers/areas/IMD.svelte";
import LocalAuthorityDistrictsLayerControl from "./layers/areas/LocalAuthorityDistricts.svelte";
import LocalPlanningAuthoritiesLayerControl from "./layers/areas/LocalPlanningAuthorities.svelte";
import ParliamentaryConstituenciesLayerControl from "./layers/areas/ParliamentaryConstituencies.svelte";
import WardsLayerControl from "./layers/areas/Wards.svelte";
import BusRoutesLayerControl from "./layers/lines/BusRoutes.svelte";
import CyclePathsLayerControl from "./layers/lines/CyclePaths.svelte";
import MrnLayerControl from "./layers/lines/MajorRoadNetwork.svelte";
import PctLayerControl from "./layers/lines/PCT.svelte";
import RoadSpeedsLayerControl from "./layers/lines/RoadSpeeds.svelte";
import RoadWidthsLayerControl from "./layers/lines/RoadWidths.svelte";
import CriticalIssuesLayerControl from "./layers/points/CriticalIssues.svelte";
import CrossingsLayerControl from "./layers/points/Crossings.svelte";
import CycleParkingLayerControl from "./layers/points/CycleParking.svelte";
import HospitalsLayerControl from "./layers/points/Hospitals.svelte";
import RailwayStationsLayerControl from "./layers/points/RailwayStations.svelte";
import SchoolsLayerControl from "./layers/points/Schools.svelte";
import SportsSpacesLayerControl from "./layers/points/SportsSpaces.svelte";
import VehicleCountsLayerControl from "./layers/points/VehicleCounts.svelte";

export let style: string;

Expand Down
12 changes: 12 additions & 0 deletions src/lib/browse/layers/OsOglLicense.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script lang="ts">
import { ExternalLink } from "lib/common";
</script>

<p>
License: <ExternalLink
href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
>
Open Government License
</ExternalLink>. Contains OS data &copy; Crown copyright and database right
2023.
</p>
9 changes: 9 additions & 0 deletions src/lib/browse/layers/OsmLicense.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script lang="ts">
import { ExternalLink } from "lib/common";
</script>

<p>
License: <ExternalLink href="https://www.openstreetmap.org/copyright">
Open Data Commons Open Database License
</ExternalLink>
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors } from "../colors";
import SequentialLegend from "./SequentialLegend.svelte";
import { colors } from "../../colors";
import OsOglLicense from "../OsOglLicense.svelte";
import SequentialLegend from "../SequentialLegend.svelte";

let name = "census_output_areas";
let outlineLayer = `${name}-outline`;
Expand Down Expand Up @@ -217,14 +218,7 @@
ONS Geography
</ExternalLink>.
</p>
<p>
License: <ExternalLink
href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
>
Open Government License
</ExternalLink>. Contains OS data &copy; Crown copyright and database
right 2023.
</p>
<OsOglLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors } from "../colors";
import { colors } from "../../colors";
import OsOglLicense from "../OsOglLicense.svelte";

let name = "combined_authorities";
let color = colors.combined_authorities;
Expand Down Expand Up @@ -72,14 +73,7 @@
ONS Geography
</ExternalLink>, as of December 2022.
</p>
<p>
License: <ExternalLink
href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
>
Open Government License
</ExternalLink>. Contains OS data &copy; Crown copyright and database
right 2023.
</p>
<OsOglLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors } from "../colors";
import SequentialLegend from "./SequentialLegend.svelte";
import { colors } from "../../colors";
import OsOglLicense from "../OsOglLicense.svelte";
import SequentialLegend from "../SequentialLegend.svelte";

let name = "imd";
let outlineLayer = `${name}-outline`;
Expand Down Expand Up @@ -83,14 +84,7 @@
here
</ExternalLink>.
</p>
<p>
License: <ExternalLink
href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
>
Open Government License
</ExternalLink>. Contains OS data &copy; Crown copyright and database
right 2023.
</p>
<OsOglLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors } from "../colors";
import { colors } from "../../colors";
import OsOglLicense from "../OsOglLicense.svelte";

let name = "local_authority_districts";
let color = colors.local_authority_districts;
Expand Down Expand Up @@ -72,14 +73,7 @@
ONS Geography
</ExternalLink>, as of May 2023.
</p>
<p>
License: <ExternalLink
href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
>
Open Government License
</ExternalLink>. Contains OS data &copy; Crown copyright and database
right 2023.
</p>
<OsOglLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors } from "../colors";
import { colors } from "../../colors";
import OsOglLicense from "../OsOglLicense.svelte";

let name = "local_planning_authorities";
let color = colors.local_planning_authorities;
Expand Down Expand Up @@ -98,14 +99,7 @@
planning.data.gov.uk
</ExternalLink>, as of November 2022.
</p>
<p>
License: <ExternalLink
href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
>
Open Government License
</ExternalLink>. Contains OS data &copy; Crown copyright and database
right 2023.
</p>
<OsOglLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors } from "../colors";
import { colors } from "../../colors";
import OsOglLicense from "../OsOglLicense.svelte";

let name = "parliamentary_constituencies";
let color = colors.parliamentary_constituencies;
Expand Down Expand Up @@ -85,13 +86,7 @@
Ordnance Survey Boundary-Line
</ExternalLink>, as of May 2023.
</p>
<p>
License: <ExternalLink
href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
>
Open Government License
</ExternalLink>
</p>
<OsOglLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors } from "../colors";
import { colors } from "../../colors";
import OsOglLicense from "../OsOglLicense.svelte";

let name = "wards";
let color = colors.wards;
Expand Down Expand Up @@ -77,14 +78,7 @@
ONS Geography
</ExternalLink>, as of May 2023.
</p>
<p>
License: <ExternalLink
href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
>
Open Government License
</ExternalLink>. Contains OS data &copy; Crown copyright and database
right 2023.
</p>
<OsOglLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors } from "../colors";
import { colors } from "../../colors";
import OsmLicense from "../OsmLicense.svelte";

let name = "bus_routes";

Expand Down Expand Up @@ -66,11 +67,7 @@
</ExternalLink>, and doesn't include which routes are run or the
frequency of service.
</p>
<p>
License: <ExternalLink href="https://www.openstreetmap.org/copyright">
Open Data Commons Open Database License
</ExternalLink>
</p>
<OsmLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import {
ColorLegend,
ExternalLink,
HelpButton,
InteractiveLayer,
publicResourceBaseUrl,
Expand All @@ -15,7 +14,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors, denseLineWidth } from "../colors";
import { colors, denseLineWidth } from "../../colors";
import OsmLicense from "../OsmLicense.svelte";

let name = "cycle_paths";

Expand Down Expand Up @@ -119,11 +119,7 @@
OpenStreetMap data. Please do report issues with the classification or
data.
</p>
<p>
License: <ExternalLink href="https://www.openstreetmap.org/copyright">
Open Data Commons Open Database License
</ExternalLink>
</p>
<OsmLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors } from "../colors";
import { colors } from "../../colors";
import OsOglLicense from "../OsOglLicense.svelte";

let name = "mrn";
let color = colors.mrn;
Expand Down Expand Up @@ -54,13 +55,7 @@
Major Road Network
</ExternalLink>, as of September 2021.
</p>
<p>
License: <ExternalLink
href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
>
Open Government License
</ExternalLink>
</p>
<OsOglLicense />
</HelpButton>
</span>
</Checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors, denseLineWidth } from "../colors";
import SequentialLegend from "./SequentialLegend.svelte";
import { colors, denseLineWidth } from "../../colors";
import SequentialLegend from "../SequentialLegend.svelte";

// TODO It'd be much simpler to have one source with both attributes
let nameCommute = "pct_commute";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors, denseLineWidth } from "../colors";
import SequentialLegend from "./SequentialLegend.svelte";
import { colors, denseLineWidth } from "../../colors";
import SequentialLegend from "../SequentialLegend.svelte";

let name = "road_speeds";
let colorScale = colors.sequential_low_to_high;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
} from "lib/maplibre";
import type { MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { colors, denseLineWidth } from "../colors";
import SequentialLegend from "./SequentialLegend.svelte";
import { colors, denseLineWidth } from "../../colors";
import SequentialLegend from "../SequentialLegend.svelte";

let name = "road_widths";
let colorScale = colors.sequential_low_to_high;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
} from "lib/maplibre";
import type { GeoJSONSource, MapGeoJSONFeature } from "maplibre-gl";
import { map } from "stores";
import { parseCriticalIssuesExcel } from "../data";
import { parseCriticalIssuesExcel } from "../../data";

let fileInput: HTMLInputElement;

Expand Down
Loading
Loading