npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

osrm-isochrone

v3.0.0

Published

creates drivetime isochrones from osrm routes

Downloads

29

Readme

osrm-isochrone

Warning: this is experimental

Build Status

Generate drive-time isochrones from OpenStreetMap data using OSRM.

##Install

npm install osrm-isochrone

##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/osrm-isochrone/osrm/lib/binding/osrm-extract mydata.osm -p ./node_modules/osrm-isochrone/osrm/test/data/car.lua
./node_modules/osrm-isochrone/osrm/lib/binding/osrm-prepare mydata.osrm -p ./node_modules/osrm-isochrone/osrm/test/data/car.lua

##Usage Create a file containing something such as:

var isochrone = require('osrm-isochrone');

var time = 300; // 300 second drivetime (5 minutes)
var location = [-77.02926635742188,38.90011780426885]; // center point
    // Note: coordinates are E/W , N/S
var options = {
  resolution: 25, // sample resolution
  maxspeed: 70, // in 'unit'/hour
  unit: 'miles', // 'miles' or 'kilometers'
  network: './dc.osrm' // prebuilt dc osrm network file, or use the one just built.
}

isochrone(location, time, options, function(err, drivetime) {
  if(err) throw err;
  // a geojson linestring
  console.log(JSON.stringify(drivetime))
});

Run with

node my-file.js

The output will be in GeoJSON format.

###Advanced Alternatively the network parameter can be an OSRM module instance. Allowing setup an OSRM with custom parameters, e.g. usage of shared-memory.

You can too define your own function to draw line/polygon instead of default:

var concave = require('turf-concave');
var Isochrone = require('osrm-isochrone');

var time = 300; // 300 second drivetime (5 minutes)
var location = [-77.02926635742188,38.90011780426885]; // center point
var options = {
  resolution: 25, // sample resolution
  maxspeed: 70, // in 'unit'/hour
  unit: 'miles', // 'miles' or 'kilometers'
  network: './dc.osrm' // prebuild dc osrm network file
}

var isochrone = new Isochrone(location, time, options, function(err, drivetime) {
  if(err) throw err;
  // your geojson from draw overload
  console.log(JSON.stringify(drivetime))
});
isochrone.draw = function(destinations) {
  var inside = destinations.features.filter(function(feat) {
    return feat.properties.eta <= time;
  });
  destinations.features = inside;
  return concave(destinations, this.sizeCellGrid, unit);
}
isochrone.getIsochrone();