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

ambulances

v1.1.0

Published

From the location of ambulance posts, create two GeoJSON files, one that contains their locations, the other contains the area they can reach within 15 minutes. To determine this, we are creating a small script that will use [OSRM](https://project-osrm.

Downloads

4

Readme

Howfar

Create GeoJSON isochrone contours based on how far you can drive, cycle or walk in an interval based on the Open Source Routing Machine (OSRM).

Although there are multiple npm packages that provide a similar service, e.g. isochrone and galton, this one uses an OSRM REST source instead of the alternatives, which rely on node bindings. Although node bindings are probably more performant, they are notoriously difficult to install on Windows, since node-gyp sucks and the latest binaries were released for node 8. Also it is quite a pain if you first need to create the required OSRM graph in order to run it a few times. Therefore, this version uses the public OSRM service, which should be fine for a few queries, but you can specify your own OSRM service too if you need to resolve many locations.

While implementing the previously mentioned methods, I noticed that the quality was not very good: it requires a lot of tweaking of specific parameters in order to get acceptable results. Furthermore, they create a rectangular grid around the desired location, which does not make sense as most isochrones will more likely be round. Further investigations lead to the work of geolytix, and that version is implemented here. Another interesting read is Peter Liu's explanation of the MapBox implementation.

Usage: howfar [options]

Returns a GeoJSON file indicating how far you can travel starting at the provided coordinates.
    You can use it as a REST service when no coordinates are supplied, or as a command by supplying them.
    In case you use it as a service, query it using http://localhost:PORT/lat/lon/bands
    (where /bands is optional). For example, when the service is running on port 3000, use
    http://localhost:3000/52.373083994540266/4.891233444213867?distance=15&bands=5&detail=3

Options:
  -V, --version                     output the version number
  -c, --coordinates <lat, lon>      Start coordinate as "lon, lat"
  -d, --distance <values>           Max distance in minutes (default: 15)
  -p, --port <number>               Port to use for exposing a REST endpoint, e.g. http://localhost:PORT/lat/lon
  -t, --profile <profile>           Transport type, can be car, bike or foot (default: "car")
  -n, --serviceProvider <provider>  Link to the OSRM provider
  -o, --output                      Output file, if provided. Otherwise output will be send to stdout.
  -h, --help                        display help for command

Development

npm i
npm run nodemon

Installation

npm i -g howfar

Usage

Sometimes you need to estimate how far you can get in a certain interval, and you want to display this as a GeoJSON file. For a simple case, you can just run the command line version to convert a starting coordinate to an isochrone, e.g.

howfar -c "5.5, 51.5" -o isochrone.geojson

In case you want to run it as a service, you can provide a port too. To see more options, use howfar -h.

howfar -p 3000

Alternatively, if you need to perform many queries, start a local OSRM service, and use that:

howfar -p 3000 -n http://127.0.0.1:5000

To run your own service, see the Project OSRM backend service or here.