Skip to content

Commit

Permalink
Start an example for Lisbon. #56
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Feb 25, 2024
1 parent df0333e commit afd3798
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/lisbon/config.json
Original file line number Diff line number Diff line change
@@ -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"
}
57 changes: 57 additions & 0 deletions examples/lisbon/setup.py
Original file line number Diff line number Diff line change
@@ -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()
1 change: 1 addition & 0 deletions examples/lisbon/utils.py
1 change: 1 addition & 0 deletions examples/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit afd3798

Please sign in to comment.