Copied from https://github.com/Project-OSRM/osrm-backend
wget http://download.geofabrik.de/australia-oceania/new-zealand-latest.osm.pbf
Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/new-zealand-latest.osm.pbf
The flag -v "${PWD}:/data" creates the directory /data inside the docker container and makes the current working directory "${PWD}" available there. The file /data/new-zealand-latest.osm.pbf inside the container is referring to "${PWD}/new-zealand-latest.osm.pbf" on the host.
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-partition /data/new-zealand-latest.osrm
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-customize /data/new-zealand-latest.osrm
Note that new-zealand-latest.osrm
has a different file extension.
docker run -t -i -p 5000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld /data/new-zealand-latest.osrm
Make requests against the HTTP server
curl "http://localhost:5000/route/v1/driving/174.89351391792297,-41.117193321489424;174.88157272338867,-41.08994883180477?steps=true"
Optionally start a user-friendly frontend on port 9966, and open it up in your browser
docker run -p 9966:9966 osrm/osrm-frontend
xdg-open 'http://127.0.0.1:9966'
In case Docker complains about not being able to connect to the Docker daemon make sure you are in the docker group.