Urban-Analytics-Technology-Platform / od2net

https://od2net.org
Apache License 2.0
31 stars 9 forks source link

Example instructions for Leeds hospital #6

Closed dabreegster closed 1 year ago

dabreegster commented 1 year ago

From every building to https://www.openstreetmap.org/way/23196317:

AREA=leeds
URL=https://download.geofabrik.de/europe/great-britain/england/west-yorkshire-latest.osm.pbf

mkdir $AREA
curl $URL -o $AREA/input.osm.pbf
ogr2ogr -f GeoJSON -dialect sqlite -sql 'SELECT ST_Centroid(geometry) FROM multipolygons WHERE building IS NOT NULL' $AREA/origins.geojson $AREA/input.osm.pbf
# For destinations, just one hospital: https://www.openstreetmap.org/way/23196317
echo '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[-1.5521021406315,53.80241788159283],"type":"Point"}}]}' > $AREA/destinations.geojson

# Generate the "fast" network
cargo run --release -- '{"directory":"'"$AREA"'","requests":{"Generate":{"pattern":"FromEveryOriginToOneDestination"}},"routing":{"FastPaths":{"cost":"Distance"}}}'
mv $AREA/output.geojson $AREA/fast_output.geojson

# Now a rough approximation of a "quiet" network, penalizing main roads heavily
rm -f $AREA/ch.bin
cargo run --release -- '{"directory":"'"$AREA"'","requests":{"Generate":{"pattern":"FromEveryOriginToOneDestination"}},"routing":{"FastPaths":{"cost":"AvoidMainRoads"}}}'
mv $AREA/output.geojson $AREA/quiet_output.geojson

Manually load the two leeds/{fast,quiet}_output.geojson files in the viewer

dabreegster commented 1 year ago

Downloading + generating everything above took about 2 minutes for me. Ignore the origin/destination layer in the viewer, since it's still hardcoded to Cornwall.

The fast network: Screenshot from 2023-08-07 14-00-40

The quiet: Screenshot from 2023-08-07 14-00-49 Note the canal towpath really lights up.

Don't forget all the caveats about this early demo. Starting from every single building and going to one hospital is a really unrealistic pattern. And some of these resulting routes are much longer than people would realistically use.

Robinlovelace commented 1 year ago

Progress here... image

Robinlovelace commented 1 year ago

Works great, thanks Dustin!

image

Robinlovelace commented 1 year ago

Complete for sure. I plan to open an issue at some point re Alder Hay hospital in Liverpool.