-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start a mode to look for OSM ways that might need sidewalk=separate
- Loading branch information
1 parent
b31a5eb
commit 521c167
Showing
7 changed files
with
134 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use geo::Intersects; | ||
use geojson::GeoJson; | ||
use rstar::{RTree, RTreeObject}; | ||
|
||
use crate::MapModel; | ||
|
||
pub fn find_separate_sidewalks(map: &MapModel) -> GeoJson { | ||
let footways = RTree::bulk_load( | ||
map.roads | ||
.iter() | ||
.filter(|r| r.tags.is("highway", "footway")) | ||
.map(|r| r.linestring.clone()) | ||
.collect(), | ||
); | ||
|
||
let mut features = Vec::new(); | ||
'ROAD: for r in &map.roads { | ||
if r.tags.is("highway", "footway") | ||
|| r.tags.is("sidewalk", "separate") | ||
|| r.tags.is("sidewalk:left", "separate") | ||
|| r.tags.is("sidewalk:right", "separate") | ||
|| r.tags.is("sidewalk:both", "separate") | ||
{ | ||
continue; | ||
} | ||
|
||
// Along this road, if we project away, do we hit a footway? | ||
for line in crate::heatmap::make_perpendicular_offsets(&r.linestring, 25.0, 15.0) { | ||
for footway in footways.locate_in_envelope_intersecting(&line.envelope()) { | ||
if footway.intersects(&line) { | ||
features.push(r.to_gj(&map.mercator)); | ||
continue 'ROAD; | ||
} | ||
} | ||
} | ||
} | ||
GeoJson::from(features) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<script lang="ts"> | ||
import { GeoJSON, hoverStateFilter, LineLayer } from "svelte-maplibre"; | ||
import { SplitComponent } from "svelte-utils/top_bar_layout"; | ||
import { PropertiesTable, notNull } from "svelte-utils"; | ||
import { Popup } from "svelte-utils/map"; | ||
import { model } from "./stores"; | ||
import NavBar from "./NavBar.svelte"; | ||
</script> | ||
|
||
<SplitComponent> | ||
<div slot="top"><NavBar /></div> | ||
<div slot="sidebar"> | ||
<h2>Fix OSM sidewalk=separate mode</h2> | ||
<p> | ||
This shows roads that seem to have a parallel sidewalk. Click one to open | ||
OSM, then (if appropriate) add <b>sidewalk=separate</b> (or a <b>:left</b> | ||
/ <b>:right</b> variant). | ||
</p> | ||
</div> | ||
<div slot="map"> | ||
<GeoJSON | ||
data={JSON.parse(notNull($model).findSeparateSidewalks())} | ||
generateId | ||
> | ||
<LineLayer | ||
paint={{ | ||
"line-width": hoverStateFilter(5, 7), | ||
"line-color": "red", | ||
}} | ||
manageHoverState | ||
on:click={(e) => | ||
window.open(notNull(e.detail.features[0].properties).way, "_blank")} | ||
hoverCursor="pointer" | ||
> | ||
<Popup openOn="hover" let:props> | ||
<h2>Classified as {props.kind}</h2> | ||
<PropertiesTable properties={props} /> | ||
</Popup> | ||
</LineLayer> | ||
</GeoJSON> | ||
</div> | ||
</SplitComponent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters