https://github.com/stepankuzmin/distance-matrix
Calculate distance matrix of arbitrary size using The Open Source Routing Machine
https://github.com/stepankuzmin/distance-matrix
distance-matrix javascript library node osrm
Last synced: 9 months ago
JSON representation
Calculate distance matrix of arbitrary size using The Open Source Routing Machine
- Host: GitHub
- URL: https://github.com/stepankuzmin/distance-matrix
- Owner: stepankuzmin
- License: mit
- Created: 2016-02-07T13:35:49.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-07-11T20:42:24.000Z (over 2 years ago)
- Last Synced: 2024-05-01T21:44:10.225Z (over 1 year ago)
- Topics: distance-matrix, javascript, library, node, osrm
- Language: JavaScript
- Homepage:
- Size: 506 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# OSRM distance matrix
[](https://travis-ci.org/stepankuzmin/distance-matrix)
**Warning**: this is experimental.
Calculate large distance matrix using [The Open Source Routing Machine](http://project-osrm.org/)
## Installation
```shell
npm install distance-matrix
```
...or build from source
```shell
git clone https://github.com/stepankuzmin/distance-matrix.git
cd distance-matrix
npm install
```
## Build
An osrm file is required for routing. This can be generated using included binaries. (_Note: this will take a lot of processing power if you are planning to use the entire planet.osm file, for general use a regional OSM data extract is preferable. More info [here](https://github.com/Project-OSRM/osrm-backend/wiki/Running-OSRM)_)
```sh
# first download an osm file containing the area you need
./node_modules/distance-matrix/osrm/lib/binding/osrm-extract mydata.osm -p ./node_modules/distance-matrix/osrm/test/data/car.lua
./node_modules/distance-matrix/osrm/lib/binding/osrm-prepare mydata.osrm -p ./node_modules/distance-matrix/osrm/test/data/car.lua
```
## Usage
See the [API](https://github.com/stepankuzmin/distance-matrix/blob/master/docs/API.md), `examples/tsv/index.js` and `test/index.js` for examples of calculating large distance matrices.