{"id":13426181,"url":"https://github.com/door2door-io/osrm-express-server-demo","last_synced_at":"2025-03-15T21:30:45.446Z","repository":{"id":77766683,"uuid":"100717376","full_name":"door2door-io/osrm-express-server-demo","owner":"door2door-io","description":"A brief example to combine OSRM with Express (NodeJs)","archived":true,"fork":false,"pushed_at":"2019-02-08T13:34:50.000Z","size":739,"stargazers_count":66,"open_issues_count":1,"forks_count":30,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-28T04:25:37.911Z","etag":null,"topics":["docker","nodejs","osrm"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/door2door-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-08-18T13:59:29.000Z","updated_at":"2024-03-12T12:23:24.000Z","dependencies_parsed_at":"2023-03-06T02:15:12.607Z","dependency_job_id":null,"html_url":"https://github.com/door2door-io/osrm-express-server-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/door2door-io%2Fosrm-express-server-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/door2door-io%2Fosrm-express-server-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/door2door-io%2Fosrm-express-server-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/door2door-io%2Fosrm-express-server-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/door2door-io","download_url":"https://codeload.github.com/door2door-io/osrm-express-server-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243792287,"owners_count":20348609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","nodejs","osrm"],"created_at":"2024-07-31T00:01:28.284Z","updated_at":"2025-03-15T21:30:45.103Z","avatar_url":"https://github.com/door2door-io.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# osrm-express-server-demo\n\nA brief example to combine OSRM with Express (NodeJs) to build your own\nproduction-ready instance.\n\nIt is based on [Open Source Routing Machine (OSRM)](https://project-osrm.org)\nand [Express](http://expressjs.com/).\n\n\n## Requirements\n\nIn order to run this application you need to install _Docker_:\n\n* Mac OSX via homebrew: `brew cask install docker`\n* others: [https://docs.docker.com/engine/installation/](https://docs.docker.com/engine/installation/)\n\nIf the installation is successful, you should be able to run the following command\nand get a similar response:\n\n    docker version\n\n    # output:\n    Client:\n     Version:      17.07.0-ce-rc1\n     API version:  1.31\n     Go version:   go1.8.3\n     Git commit:   8c4be39\n     Built:        Wed Jul 26 05:20:09 2017\n     OS/Arch:      darwin/amd64\n    Server:\n     Version:      17.07.0-ce-rc1\n     API version:  1.31 (minimum version 1.12)\n     Go version:   go1.8.3\n     Git commit:   8c4be39\n     Built:        Wed Jul 26 05:25:01 2017\n     OS/Arch:      linux/amd64\n     Experimental: true\n\n\n## Setup - Building the containers\n\n* the main application: `docker build -t osrm-express-server -f Dockerfile.nodejs .`\n* osmium-tool for data manipulation: `docker build -t osmium-tool -f Dockerfile.osmium-tool .`\n* osrm-backend to generate the routable graph: `docker pull osrm/osrm-backend:v5.22.0`\n\n## Data preprocessing\n\nIn order to run this application a routable graph generated by OSRM is required.\nOSRM itself can build a graph from various sources, in the following OpenStreetMap (OSM)\ndata is used.\n\n### Get OSM data for your region of interest\n\nDownload the region you are interested in (e.g. Europe) from [Geofabrik](http://download.geofabrik.de/) or similar\nsources and save the result in the folder `data/`\n\n    curl --create-dirs --output data/osrm/example-areas/europe-latest.osm.pbf http://download.geofabrik.de/europe-latest.osm.pbf\n\n\n### Optional: Clip the OSM data\n\nIf your preferred region is not available, you can take a larger dataset and clip it to specific areas.\nThe following will use the `europe-latest.osm.pbf` dataset, extract Berlin and London and save it as a new\ndataset.\n\nWe can now make use of the previously containerised `osmium-tool` to extract specific areas with a `.poly` file.\nRead more about Poly-files [here](http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format):\n\n    docker run -it -v $(pwd)/data:/data osmium-tool extract -p /data/polyfiles/example-areas.poly /data/osrm/example-areas/europe-latest.osm.pbf -o /data/osrm/example-areas/example-areas.osm.pbf\n\n\n### Create a routable graph\n\nOnce we have our dataset, we can pass it to the OSRM container to create a routable graph with a given profile (car, foot, bike, ...)\nwith the contraction hierachies algorithm:\n\n    # extract the network and create the osrm file(s)\n    docker run -it -v $(pwd)/data:/data osrm/osrm-backend:v5.16.1 osrm-extract -p /opt/car.lua /data/osrm/example-areas/example-areas.osm.pbf\n\n    # create the graph\n    docker run -it -v $(pwd)/data:/data osrm/osrm-backend:v5.16.1 osrm-contract /data/osrm/example-areas/example-areas.osrm\n\nThe dataset is now available at `./data/osrm/example-areas` and can be used by any OSRM instance running the same version.\n\n## Starting the server\n\nIn order to launch the application with the specified dataset (see above), run\nthe container with the required environment variables, port mapping and volume bindings:\n\n    docker run --env-file .env -d -p 5000:5000 -v $(pwd)/data:/data osrm-express-server\n\nThe `.env` file is a (modified) copy of the `.env.example` file contained in this repository.\nPlease adapt it according to your needs.\n\nAlso please make sure to map the correct volumes (host and container) as well as the ports in\norder to access the server.\n\nAfter the application has loaded the graph in memory, you can make requests to the server running at [http://localhost:5000](http://localhost:5000)\n\n## API Endpoints\n\nThis example application has 3 different endpoints\n\n* `GET /health`: A simple ping endpoint to check that the server is running.\n\n* `POST /route`: Implements calls to `osrm.route` to calculate the way from A to B.\n\n  _Example body_:\n  ```\n    { coordinates: [[13.3905, 52.5205], [13.3906, 52.5206]] }\n  ```\n\n* `POST /table`: Implements calls to `osrm.table` to get a travel times matrix for all provided locations.\n\n  _Example body_:\n  ```\n    { coordinates: [[13.3905, 52.5205], [13.3906, 52.5206]] }\n  ```\n\nThe source code should be simple enough to provide an overview and to get started for\nextensions / own development.\n\n## Testing\n\nThis repository also includes a small and simple test suite.\nIn order to run the tests in the container, execute the following commands:\n\n    docker run -it --env-file .env -v $(pwd)/data:/data -p 5000:5000 osrm-express-server yarn lint\n    docker run -it --env-file .env -v $(pwd)/data:/data -p 5000:5000 osrm-express-server yarn test\n\nThe test graph is a small subsample of areas in Berlin and London and is included in this repository.\nWhenever you upgrade to a newer OSRM version, you need to rebuild the test graph as well to successfully run the tests again:\n\n    docker run -it -v $(pwd)/data:/data osrm/osrm-backend:v5.22.0 osrm-extract -p /opt/car.lua /data/osrm/test/test.osm.pbf\n    docker run -it -v $(pwd)/data:/data osrm/osrm-backend:v5.22.0 osrm-partition /data/osrm/test/test.osm.pbf\n    docker run -it -v $(pwd)/data:/data osrm/osrm-backend:v5.22.0 osrm-customize /data/osrm/test/test.osm.pbf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoor2door-io%2Fosrm-express-server-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoor2door-io%2Fosrm-express-server-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoor2door-io%2Fosrm-express-server-demo/lists"}