-
Notifications
You must be signed in to change notification settings - Fork 0
0SRM
In order to get OSRM data, you need to download the California Open Street Map data and then process it using OSRM. The OSRM process can happen either in docker or using the nodeJS binding libraries.
DOCKER (optional): Get the docker image:
docker pull osrm/osrm-backend
NodeJS:
npm install @project-osrm/osrm
Next, in some folder grab the California OSM data:
curl -O https://download.geofabrik.de/north-america/us/california-latest.osm.pbf
Make sure you have enough RAM available to docker if you are going to use it. I used 16GB. See: https://docs.docker.com/docker-for-mac/#memory.
OSRM needs a vehicle transportation profile to run. By default they include examples such as car or bicycle. We are using a special forestry profile. Whatever profile you use, pass it in during the first step below. It needs to be in the correct node_modules directory to run.
NodeJS:
node_modules/@project-osrm/osrm/lib/binding/osrm-extract data/california-latest.osm.pbf -p node_modules/@project-osrm/osrm/profiles/forestry.lua
node_modules/@project-osrm/osrm/lib/binding/osrm-contract data/california-latest
See https://github.com/Project-OSRM/osrm-backend/blob/master/docs/nodejs/api.md for more details. This seems to be the easiest method, but an officially recommended docker method is also provided below.
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/california-latest.osm.pbf
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-partition /data/california-latest.osrm
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-customize /data/california-latest.osrm
This should give you a directory full of *.osrm.*
files which you can use with the OSRM JS library.
More info about the docker container and OSRM backend info available at: https://hub.docker.com/r/osrm/osrm-backend