Search stations/stops/regions by location.
FPTF location
object with longitude
and latitude
information.
Required
options are supported by every module. For non-required
options, the main FPTI principle still applies: If a certain feature/option is available, it must be provided as described below.
Note that modules might provide additional options as long as they don't use reserved option attributes.
Attribute | Description | Required | Value type | Default |
---|---|---|---|---|
results |
Max. number of results returned | ✅ | Number |
null |
distance |
Maximum distance in meters | ❌ | number |
null |
The features
object would look like this for a module which only supports the required options:
{
results: 'Max. number of results returned'
// additionalOption: 'description of this option'
}
Returns a Promise
that resolves in an Array
of station
/ stop
/ region
FPTF@1 objects.
const module = require('fpti-module')
const location = {
type: 'location',
longitude: 13.369,
latitude: 52.525
}
const nearbyStations = module.stations.nearby(location)
const nearbyStops = module.stops.nearby(location, {distance: 1500}) // max. distance: 1.5km
const nearbyRegions = module.regions.nearby(location, {distance: 1000, moduleSpecificOption: 'value'})
nearbyStations.then(data => {
// data is an array of FPTF station objects
console.log(data)
})
console.log(module.stations.nearby.features) // all options