Skip to content

Commit

Permalink
Stop displaying severances in the auto boundaries mode. #145
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Feb 21, 2025
1 parent 2846e97 commit 9089c87
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 36 deletions.
22 changes: 1 addition & 21 deletions backend/src/auto_boundaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,16 @@ impl MapModel {
"tertiary_link",
],
) {
let mut f = self.mercator.to_wgs84_gj(&road.linestring);
// TODO Important to distinguish, or just debugging?
f.set_property("kind", "road severance");
features.push(f);

severances.push(road.linestring.clone());
road_severances.push(road.linestring.clone());
}
}

for linestring in &self.railways {
let mut f = self.mercator.to_wgs84_gj(linestring);
f.set_property("kind", "railway severance");
features.push(f);

severances.push(linestring.clone());
}

for linestring in &self.waterways {
let mut f = self.mercator.to_wgs84_gj(linestring);
f.set_property("kind", "waterway severance");
features.push(f);

severances.push(linestring.clone());
}

Expand Down Expand Up @@ -105,14 +92,7 @@ impl GeneratedBoundary {
pub fn to_feature(&self, map: &MapModel) -> Feature {
let mut projected = self.clone();
map.mercator.to_wgs84_in_place(&mut projected.geometry);
let mut feature =
geojson::ser::to_feature(projected).expect("should have no unserializable fields");
let props = feature
.properties
.as_mut()
.expect("GeneratedBoundary always has properties");
props.insert("kind".to_string(), "area".into());
feature
geojson::ser::to_feature(projected).expect("should have no unserializable fields")
}
}

Expand Down
22 changes: 10 additions & 12 deletions web/src/AutoBoundariesMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
type LayerClickInfo,
} from "svelte-maplibre";
import { downloadGeneratedFile } from "svelte-utils";
import { isLine, isPolygon, makeRamp, Popup } from "svelte-utils/map";
import { makeRamp, Popup } from "svelte-utils/map";
import { SplitComponent } from "svelte-utils/top_bar_layout";
import BackButton from "./BackButton.svelte";
import { layerId, Link } from "./common";
Expand Down Expand Up @@ -72,7 +72,6 @@
): ExpressionSpecification {
let x: ExpressionSpecification = [
"all",
isPolygon,
[">=", ["get", "area_km2"], minArea],
];
if (removeNonRoad) {
Expand Down Expand Up @@ -135,16 +134,6 @@

<div slot="map">
<GeoJSON data={gj} generateId>
<LineLayer
{...layerId("auto-boundaries-severances")}
filter={isLine}
manageHoverState
paint={{
"line-color": hoverStateFilter("black", "red"),
"line-width": 3,
}}
/>

<FillLayer
{...layerId("neighbourhood-boundaries", false)}
filter={makeFilter(minArea, removeNonRoad)}
Expand Down Expand Up @@ -226,6 +215,15 @@
{props.area_km2.toFixed(1)} km²
</Popup>
</FillLayer>

<LineLayer
{...layerId("neighbourhood-boundaries-outline", false)}
filter={makeFilter(minArea, removeNonRoad)}
paint={{
"line-color": "black",
"line-width": 1,
}}
/>
</GeoJSON>
</div>
</SplitComponent>
5 changes: 2 additions & 3 deletions web/src/common/zorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ const layerZorder = [

streets("Ferry line"),

"neighbourhood-boundaries-outline",

"debug-borders",
"debug-filters",

Expand Down Expand Up @@ -143,9 +145,6 @@ const layerZorder = [
"border-arrows",
"border-arrow-outlines",

"auto-boundaries-areas",
"auto-boundaries-severances",

"freehand-line",

"edit-polygon-fill",
Expand Down

0 comments on commit 9089c87

Please sign in to comment.