distance-matrix

Calculate large distance matrix using The Open Source Routing Machine

Usage no npm install needed!

<script type="module">
  import distanceMatrix from 'https://cdn.skypack.dev/distance-matrix';
</script>

README

OSRM distance matrix

Build Status Greenkeeper badge

Warning: this is experimental

Calculate large distance matrix using The Open Source Routing Machine

Installation

npm install distance-matrix

...or build from source

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)

# 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, examples/tsv/index.js and test/index.js for examples of calculating large distance matrices.