Tutorial: Running in a new area
October 16, 2024 ยท View on GitHub
This tutorial will guide you through using od2net in a new area. I'm assuming you've been through the previous tutorial.
The overall process is:
- Create your study area
- Prepare origin/destination input
- Specify configuration to customize the route cost function, level of traffic stress, uptake model, etc.
- Run
odnet - Use the web viewer to explore the output, or write your own analysis to use the results
Where to put your code
You can keep all of your work just on your own computer, or start your own git repo if you like. At minimum, it'll just be a few files, like any of the examples.
If you'd like to contribute your area to the od2net examples, please do! I'm not sure yet how many official examples I'll maintain long-term, but I'm happy to add many for now. Please fork the od2net repo, start a new branch with your addition, then send a PR from your fork.
Scripting
The od2net examples all use Python and rely on external tools like osmium and ogr2ogr to do lots of the heavy lifting. You're free to use R, Java, or any language you're comfortable with, and to use any dependencies that're helpful. You can also just create all of the inputs manually, though I'd encourage scripting so somebody else can reproduce your data science workflow.
Step 1: Creating your study area
od2net needs an osm.pbf file as input. You can create this however you like -- the examples download a big file from Geofabrik, then use osmium to clip.
Step 2: Preparing origin/destination input
See here to start your config.json.
Step 3: Configuration
Now you need to specify:
See the Rust definitions for all config.json options.
Step 4: Running od2net
If you're working your own repo, you'll need the od2net executable installed somewhere. If you're building it yourself, then run the following command:
cargo install --locked --git https://github.com/Urban-Analytics-Technology-Platform/od2net
This adds the od2net command should be added to your shell path. Or you can use Docker.
So either run:
od2net config.json
or:
docker run -v $(pwd):/app ghcr.io/urban-analytics-technology-platform/od2net:main /app/config.json
Step 5: Using the output
Go to https://od2net.org to load output/rnet.pmtiles.