Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including nearest-db-stations with all npm packages installed. Try it out:

var nearestDbStations = require("nearest-db-stations")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

nearest-db-stations v1.0.0

Find the nearest DB Stations given a Latitude and a Longitude

nearest-db-stations

Searches the nearest stations of Deutsche Bahn, using geokdbush. Data taken from the excellent db-stations package.

build status npm version npm version ISC-licensed

Installing

npm install nearest-db-stations

Usage

const nearestStations = require('nearest-db-stations')

const latitude = 52.509647;
const longitude = 13.375944;

const stations = nearestStations(latitude, longitude);

// Output as in db-stations


API

nearestStations(longitude, latitude[, maxDistance, maxResults])

Returns an array of the closest points from a given location in order of increasing distance.

  • longitude: query point longitude.
  • latitude: query point latitude.
  • maxDistance: (optional) maximum distance in meters to search within (Infinity by default).
  • maxResults: (optional) maximum number of points to return (5 by default).

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.

Data License

The Dataset is published under Creative Commons Attribution 4.0 International by Deutsche Bahn (DB).

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free