From bf635514f2e7fa56914d83b729458b3bd8a27aeb Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Fri, 3 May 2024 14:34:57 +0100 Subject: [PATCH] Get amenities to show up in debug mode. Forgot to fix projection. --- backend/src/amenity.rs | 1 + backend/src/scrape.rs | 3 +++ web/src/DebugMode.svelte | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/amenity.rs b/backend/src/amenity.rs index af3aa22..7c4de08 100644 --- a/backend/src/amenity.rs +++ b/backend/src/amenity.rs @@ -16,6 +16,7 @@ pub struct Amenity { impl Amenity { pub fn to_gj(&self, mercator: &Mercator) -> Feature { let mut f = Feature::from(Geometry::from(&mercator.to_wgs84(&self.point))); + f.set_property("kind", "amenity"); f.set_property("osm_id", self.osm_id.to_string()); if let Some(ref name) = self.name { f.set_property("name", name.clone()); diff --git a/backend/src/scrape.rs b/backend/src/scrape.rs index ac93e7b..c386501 100644 --- a/backend/src/scrape.rs +++ b/backend/src/scrape.rs @@ -109,6 +109,9 @@ pub fn scrape_osm(input_bytes: &[u8]) -> Result { } }) .collect(); + for a in &mut amenities { + a.point = graph.mercator.pt_to_mercator(a.point.into()).into(); + } let mut points = Vec::new(); for i in &intersections { diff --git a/web/src/DebugMode.svelte b/web/src/DebugMode.svelte index d01e22d..7c77c19 100644 --- a/web/src/DebugMode.svelte +++ b/web/src/DebugMode.svelte @@ -48,9 +48,10 @@ id="amenities" paint={{ "circle-radius": 10, - "circle-color": "cyan", + "circle-color": hoverStateFilter("cyan", "red"), }} manageHoverState + filter={["==", ["get", "kind"], "amenity"]} on:click={(e) => window.open( notNull(e.detail.features[0].properties).osm_id,