diff --git a/examples/lisbon/config.json b/examples/lisbon/config.json new file mode 100644 index 0000000..ac5bf41 --- /dev/null +++ b/examples/lisbon/config.json @@ -0,0 +1,18 @@ +{ + "requests": { + "description": "One trip from every building to the nearest (as the crow flies) school. Elevation is included.", + "pattern": "FromEveryOriginToNearestDestination", + "origins_path": "buildings.geojson", + "destinations_path": "schools.geojson" + }, + "cost": { + "ByLTS": { + "lts1": 1.0, + "lts2": 1.5, + "lts3": 3.0, + "lts4": 5.0 + } + }, + "uptake": "Identity", + "lts": "BikeOttawa" +} diff --git a/examples/lisbon/setup.py b/examples/lisbon/setup.py new file mode 100644 index 0000000..6d025a2 --- /dev/null +++ b/examples/lisbon/setup.py @@ -0,0 +1,57 @@ +import csv +import json + +from utils import * + + +def makeOSM(): + download( + url="https://download.geofabrik.de/europe/portugal-latest.osm.pbf", + outputFilename="input/portugal-latest.osm.pbf", + ) + # Clip to Lisbon + run( + [ + "osmium", + "extract", + "-b", + "-9.291687,38.673717,-9.080887,38.831685", + "input/portugal-latest.osm.pbf", + "-o", + "input/input.osm.pbf", + ] + ) + + +def makeElevation(): + # TODO LisboaCOPERNICUS_clip.tif doesn't have any errors, but no data seems to get scraped + # TODO LisboaIST_clip_r1.tif is apparently missing a TIF signature? + download( + url="https://github.com/U-Shift/Declives-RedeViaria/raw/main/raster/LisboaCOPERNICUS_clip.tif", + outputFilename="input/LisboaCOPERNICUS_clip.tif", + ) + + +def makeOrigins(): + # Use building centroids as origins + extractCentroids( + osmInput="input/input.osm.pbf", geojsonOutput="input/buildings.geojson" + ) + + +def makeDestinations(): + # School centroids as destinations + extractCentroids( + osmInput="input/input.osm.pbf", + geojsonOutput="input/schools.geojson", + where=f"amenity = 'school'", + ) + + +if __name__ == "__main__": + checkDependencies() + run(["mkdir", "-p", "input"]) + makeOSM() + #makeElevation() + makeOrigins() + makeDestinations() diff --git a/examples/lisbon/utils.py b/examples/lisbon/utils.py new file mode 120000 index 0000000..50fbc6d --- /dev/null +++ b/examples/lisbon/utils.py @@ -0,0 +1 @@ +../utils.py \ No newline at end of file diff --git a/examples/run_all.sh b/examples/run_all.sh index f6ee1be..26752aa 100755 --- a/examples/run_all.sh +++ b/examples/run_all.sh @@ -55,6 +55,7 @@ run_liverpool_example # Moderate run_example edinburgh run_example london +run_example lisbon # Huge run_example england_2011_home_to_work