Setting up your own completely offline routing engine utilizing the philippines-latest.osm.pbf file is simple. Follow these Docker commands in your server terminal:
1. Prepare Directory & Download Map
mkdir -p ~/osm-data && cd ~/osm-data
wget https://download.geofabrik.de/asia/philippines-latest.osm.pbf
2. Process Routing Graphs (OSRM)
Extract, partition, and customize the OpenStreetMap graph data using the car profile:
# Step A: Extract osm.pbf map profiles
docker run -t -v "$(pwd):/data" osrm/osrm-backend osrm-extract /data/philippines-latest.osm.pbf
# Step B: Partition cells
docker run -t -v "$(pwd):/data" osrm/osrm-backend osrm-partition /data/philippines-latest.osrm
# Step C: Customize speed profiles and routing cell structures
docker run -t -v "$(pwd):/data" osrm/osrm-backend osrm-customize /data/philippines-latest.osrm
3. Start Self-Hosted OSRM Router Container
Launch the OSRM service container on port 5000:
docker run -d -p 5000:5000 --name osrm-philippines -v "$(pwd):/data" osrm/osrm-backend osrm-routed --algorithm mld /data/philippines-latest.osrm
4. Configure API Server Proxy
Update your .env file in your Express project to point to your new offline docker containers instead of the public demo services:
# Update in your .env file
OSRM_BASE_URL=http://localhost:5000
NOMINATIM_BASE_URL=http://localhost:8080 # (If you also run Nominatim docker)