Converted from https://github.com/Project-OSRM/osrm-backend/pkgs/container/osrm-backend
Please see the Apptainer - Installing Apptainer guide for details. You do not need suid for OSRM, you do need fuse.
Assuming Ubuntu (including Windows WSL2 Ubuntu), follow these instructions.
Instructions for other sets of pre-built Linux packages can be found here.
More soon!
A one-time task.
cd some_path
git clone git@github.com:upenn/OSRM_simple.git
cd OSRM_simple
A one-time task.
cd path/to/OSRM_simple
apptainer build OSRM.sif docker:osrm/osrm-backend
A one-time task per geo area + profile to get and process the osm.pbf.
New York (the state) in this example. Details for the URLs at https://download.geofabrik.de/
cd path/to/OSRM_simple
./OSRM_setup.sh PBF_FILE_URL PROFILE
# example (new-york, car):
./OSRM_setup.sh https://download.geofabrik.de/north-america/us/new-york-latest.osm.pbf car
The OSRM_start.sh script file makes starting the OSRM server with your location and profile easy.
cd path/to/OSRM_simple
./OSRM_start LOCATION PROFILE
# example (new-york, car):
./OSRM_start.sh new-york car
Once you're done with the server, stop it:
cd path/to/OSRM_simple
# get the name of your server instance:
apptainer instance list
apptainer -v instance stop INSTANCE_NAME
# example (new-york):
apptainer instance stop OSRM-new-york-car-5000
Set up and use R with OSRM.
This is some toy work in R ... take a look at this post for some R code using the R osrm package.
Including Windows WSL2 Ubuntu ... install some required packages:
sudo apt update
sudo apt install libudunits2-dev gdal-bin gdal-data gdal-plugins libgdal-dev
If you're using R, you'll want to do this one-time tasks for the R package osrm.
Rscript --no-save -e 'install.packages("osrm", dependencies=TRUE)'
This can take some time! Grab a ☕︎. Once complete, you're all set to use R with OSRM!
Build a complete trip matrix between all points in the NYC example points data (11 points):
Rscript --no-save trip_table.R input/osrm_example_points_nyc.csv 5000
Process all trip routes in the NYC example trip data (5 trips):
Rscript --no-save trip_route.R input/osrm_example_trip_nyc.csv 5000
Results in output.