Skip to content

Latest commit

 

History

History
72 lines (50 loc) · 2.52 KB

API.md

File metadata and controls

72 lines (50 loc) · 2.52 KB

isochrone

index.js:91-119

Build isochrone using start point and options

Parameters

  • startPoint Array<float> start point [lng, lat]
  • options Object object
    • options.osrm Object OSRM instance
    • options.radius number distance to draw the buffer as in @turf/buffer
    • options.cellSize number the distance across each cell as in @turf/point-grid
    • options.intervals Array<number> intervals for isochrones in minutes
    • options.deintersect boolean whether or not to deintersect the isochrones. If this is true, then the isochrones will be mutually exclusive
    • options.concavity number relative measure of concavity as in concaveman (optional, default 2)
    • options.lengthThreshold number length threshold as in concaveman (optional, default 0)
    • options.units string any of the options supported by turf units (optional, default 'kilometers')

Examples

const OSRM = require('osrm');
const isochrone = require('isochrone');

const osrm = new OSRM({ path: './monaco.osrm' });
const startPoint = [7.41337, 43.72956];

const options = {
  osrm,
  radius: 2,
  cellSize: 0.1,
  intervals: [5, 10, 15],
  deintersect: true
};

isochrone(startPoint, options)
  .then((geojson) => {
    console.log(JSON.stringify(geojson));
  });

Returns Promise GeoJSON FeatureCollection of Polygons when resolved