From 3ac04a0ebd1749b215853b85f6e2a641375563e3 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Mon, 27 Aug 2018 12:06:14 +0200 Subject: [PATCH] reachableFrom(loc, [opt]) -> reachableFrom(address, [opt]) --- docs/reachable-from.md | 10 +++++----- docs/readme.md | 2 +- index.js | 6 +++--- test/bvg.js | 2 +- test/cmta.js | 2 +- test/db.js | 2 +- test/lib/reachable-from.js | 4 ++-- test/nahsh.js | 2 +- test/vbb.js | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/reachable-from.md b/docs/reachable-from.md index bea5fd56..abe7b786 100644 --- a/docs/reachable-from.md +++ b/docs/reachable-from.md @@ -1,10 +1,10 @@ -# `reachableFrom(location, [opt])` +# `reachableFrom(address, [opt])` -This method can be used to compute the area around a location that is reachable within a certain time. This concept is called [isochrone diagram](https://en.wikipedia.org/wiki/Isochrone_map#Transportation_planning). +This method can be used to get stations reachable within a certain time from an address. This concept is called [isochrone diagram](https://en.wikipedia.org/wiki/Isochrone_map#Transportation_planning). -*Note*: It appears that HAFAS cannot generate actual isochrones, but a list of reachable stations, which you can estimate the isochrone(s) from. +*Note*: It appears that HAFAS cannot generate actual isochrones, but only the list of reachable stations, which you can estimate the isochrone(s) from. -`location` must be an [*FPTF* `location` object](https://github.com/public-transport/friendly-public-transport-format/blob/1.1.1/spec/readme.md#location-objects). +`address` must be an [*FPTF* `location` object](https://github.com/public-transport/friendly-public-transport-format/blob/1.1.1/spec/readme.md#location-objects). With `opt`, you can override the default options, which look like this: @@ -24,7 +24,7 @@ With `opt`, you can override the default options, which look like this: ## Response -`reachableFrom(loc, [opt])` returns an array, in which each item has a `duration` and an array of [*Friendly Public Transport Format* `1.1.1`](https://github.com/public-transport/friendly-public-transport-format/tree/1.1.1) stations. +`reachableFrom(address, [opt])` returns an array, in which each item has a `duration` and an array of [*Friendly Public Transport Format* `1.1.1`](https://github.com/public-transport/friendly-public-transport-format/tree/1.1.1) stations. As an example, we're going to use the [VBB profile](../p/vbb): diff --git a/docs/readme.md b/docs/readme.md index 032e20a3..13c6e3b6 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -9,7 +9,7 @@ - [`station(id, [opt])`](station.md) – get details about a station - [`nearby(location, [opt])`](nearby.md) – show stations & POIs around - [`radar(north, west, south, east, [opt])`](radar.md) – find all vehicles currently in a certain area -- [`reachableFrom(location, [opt])`](reachable-from.md) – get all stations reachable from a location within `n` minutes +- [`reachableFrom(address, [opt])`](reachable-from.md) – get all stations reachable from an address within `n` minutes ## Writing a profile diff --git a/index.js b/index.js index bebc0cf2..bd63f9ec 100644 --- a/index.js +++ b/index.js @@ -463,8 +463,8 @@ const createClient = (profile, userAgent, request = _request) => { }) } - const reachableFrom = (location, opt = {}) => { - validateLocation(location, 'location') + const reachableFrom = (address, opt = {}) => { + validateLocation(address, 'address') opt = Object.assign({ when: Date.now(), @@ -477,7 +477,7 @@ const createClient = (profile, userAgent, request = _request) => { return request(profile, userAgent, opt, { meth: 'LocGeoReach', req: { - loc: profile.formatLocation(profile, location, 'location'), + loc: profile.formatLocation(profile, address, 'address'), maxDur: opt.maxDuration, maxChg: opt.maxTransfers, date: profile.formatDate(profile, opt.when), diff --git a/test/bvg.js b/test/bvg.js index a3aa3543..eeb2026b 100644 --- a/test/bvg.js +++ b/test/bvg.js @@ -380,7 +380,7 @@ test('reachableFrom', co(function* (t) { yield testReachableFrom({ test: t, reachableFrom: client.reachableFrom, - loc: torfstr17, + address: torfstr17, when, maxDuration: 15, validate diff --git a/test/cmta.js b/test/cmta.js index a92b31fe..d6a970ae 100644 --- a/test/cmta.js +++ b/test/cmta.js @@ -266,7 +266,7 @@ test('reachableFrom', co(function* (t) { yield testReachableFrom({ test: t, reachableFrom: client.reachableFrom, - loc: { + address: { type: 'location', address: '604 W 9TH ST, Austin, TX 78701', latitude: 30.272910, diff --git a/test/db.js b/test/db.js index 04f9b7e8..ae916ece 100644 --- a/test/db.js +++ b/test/db.js @@ -361,7 +361,7 @@ test('reachableFrom', co(function* (t) { yield testReachableFrom({ test: t, reachableFrom: client.reachableFrom, - loc: torfstr17, + address: torfstr17, when, maxDuration: 15, validate diff --git a/test/lib/reachable-from.js b/test/lib/reachable-from.js index 162d8a23..f7b5b293 100644 --- a/test/lib/reachable-from.js +++ b/test/lib/reachable-from.js @@ -8,13 +8,13 @@ const testReachableFrom = co(function* (cfg) { const { test: t, reachableFrom, - loc, + address, when, maxDuration, validate } = cfg - const results = yield reachableFrom(loc, { + const results = yield reachableFrom(address, { when, maxDuration }) diff --git a/test/nahsh.js b/test/nahsh.js index 8270486f..be005d7a 100644 --- a/test/nahsh.js +++ b/test/nahsh.js @@ -360,7 +360,7 @@ test('reachableFrom', co(function* (t) { yield testReachableFrom({ test: t, reachableFrom: client.reachableFrom, - loc: berlinerStr, + address: berlinerStr, when, maxDuration: 60, validate diff --git a/test/vbb.js b/test/vbb.js index 26ce99df..4695d866 100644 --- a/test/vbb.js +++ b/test/vbb.js @@ -370,7 +370,7 @@ test('reachableFrom', co(function* (t) { yield testReachableFrom({ test: t, reachableFrom: client.reachableFrom, - loc: torfstr17, + address: torfstr17, when, maxDuration: 15, validate