Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stepankuzmin/node-isochrone
NodeJS isochrone map library
https://github.com/stepankuzmin/node-isochrone
geojson isochrones library map nodejs osrm
Last synced: about 2 months ago
JSON representation
NodeJS isochrone map library
- Host: GitHub
- URL: https://github.com/stepankuzmin/node-isochrone
- Owner: stepankuzmin
- License: mit
- Created: 2017-05-05T07:34:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-26T14:44:38.000Z (over 1 year ago)
- Last Synced: 2024-11-01T03:21:29.505Z (2 months ago)
- Topics: geojson, isochrones, library, map, nodejs, osrm
- Language: JavaScript
- Homepage: https://stepankuzmin.github.io/node-isochrone
- Size: 4.32 MB
- Stars: 28
- Watchers: 2
- Forks: 7
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Isochrone
[![npm version](https://img.shields.io/npm/v/isochrone.svg)](https://www.npmjs.com/package/isochrone)
[![npm downloads](https://img.shields.io/npm/dt/isochrone.svg)](https://www.npmjs.com/package/isochrone)
[![Build Status](https://travis-ci.com/stepankuzmin/node-isochrone.svg?branch=master)](https://travis-ci.com/stepankuzmin/node-isochrone)Isochrone maps are commonly used to depict areas of equal travel time.
Build isochrones using [OSRM](http://project-osrm.org/), [Turf](http://turfjs.org/) and [concaveman](https://github.com/mapbox/concaveman).![screenshot](https://raw.githubusercontent.com/stepankuzmin/galton/master/example.png)
## Installation
```sh
npm install osrm isochrone
```## Usage
### Building OSRM graph
This package consumes preprocessed [OSRM](http://project-osrm.org/) graph as an input. To build such a graph you have to extract it from your OSM file with one of [profiles](https://github.com/Project-OSRM/osrm-backend/wiki/Profiles) and build it using one of the algorithms (Contraction Hierarchies or Multi-Level Dijkstra).
To build OSRM graph using `isochrone` package, you can clone the source code and install dependencies
```sh
git clone https://github.com/stepankuzmin/node-isochrone.git
cd node-isochrone
npm i
```Here is an example of how to extract graph using `foot` profile and build it using contraction hierarchies algorithm.
```sh
wget https://s3.amazonaws.com/mapbox/osrm/testing/monaco.osm.pbf
./node_modules/osrm/lib/binding/osrm-extract -p ./node_modules/osrm/profiles/foot.lua monaco.osm.pbf
./node_modules/osrm/lib/binding/osrm-contract monaco.osrm
```### Example
See [API](https://github.com/stepankuzmin/node-isochrone/blob/master/API.md) for more info.
```js
const OSRM = require("osrm");
const isochrone = require("isochrone");const osrm = new OSRM({ path: "./monaco.osrm" });
const startPoint = [7.42063, 43.73104];
const options = {
osrm,
radius: 2,
cellSize: 0.1,
intervals: [5, 10, 15]
};isochrone(startPoint, options).then(geojson => {
console.log(JSON.stringify(geojson, null, 2));
});
```