Skip to content

Commit

Permalink
Get amenities to show up in debug mode. Forgot to fix projection.
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed May 3, 2024
1 parent 2ba44a5 commit bf63551
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/src/amenity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 3 additions & 0 deletions backend/src/scrape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ pub fn scrape_osm(input_bytes: &[u8]) -> Result<Graph> {
}
})
.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 {
Expand Down
3 changes: 2 additions & 1 deletion web/src/DebugMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bf63551

Please sign in to comment.