Project OSRM , Setup

Following steps to setup OSRM project:

a. Download the region or the PBF file from geofabrik.de
b. Waiting for #c to be done ^^, get you some popcorn please..
c. Run Extract, partition and customize
    $ docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend \
       osrm-extract -p /opt/car.lua \
       /data/indonesia-latest-230317.osrm

    $ docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend \
       osrm-partition /data/indonesia-latest-230317.osrm
    $ docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend \
       osrm-customize /data/indonesia-latest-230317.osrm
d. Run the image
    $ docker run -t -i -p 5000:5000 -v "${PWD}:/data" \
          ghcr.io/project-osrm/osrm-backend osrm-routed \
          --algorithm mld /data/indonesia-latest-230317.osrm

Example:

curl "http://127.0.0.1:5000/route/v1/driving/107.6131616,-6.9191728;107.5985437,-6.8434083?steps=true&geometries=geojson"

The result quite long, but let me extract the geometries at the beginning of the jsonfile,

{"coordinates":[[107.613245,-6.918864],[107.612391,-6.918644],[107.612022,-6.921735],[107.598352,-6.920103],[107.596119,-6.875867],[107.59581,-6.874006],[107.593506,-6.870101],[107.594339,-6.864004],[107.596214,-6.862385],[107.594688,-6.860499],[107.597242,-6.848996],[107.598472,-6.849159],[107.598502,-6.847849],[107.599995,-6.845821],[107.599399,-6.845229],[107.600187,-6.84403],[107.598512,-6.843501]],

"type":"LineString"}

Copy paste to https://geojsonlint.com/



Hope this helps ^^ 

Comments