2025-01-14 21:14:49 +00:00
|
|
|
# `locations(query, [opt])`
|
|
|
|
|
|
|
|
`query` must be an string (e.g. `'Alexanderplatz'`).
|
|
|
|
|
|
|
|
With `opt`, you can override the default options, which look like this:
|
|
|
|
|
|
|
|
```js
|
|
|
|
{
|
2025-01-14 22:16:09 +00:00
|
|
|
fuzzy: true // not supported
|
2025-01-14 21:14:49 +00:00
|
|
|
, results: 5 // how many search results?
|
|
|
|
, stops: true // return stops/stations?
|
|
|
|
, addresses: true
|
|
|
|
, poi: true // points of interest
|
2025-01-14 22:16:09 +00:00
|
|
|
, subStops: true // not supported
|
|
|
|
, entrances: true // not supported
|
|
|
|
, linesOfStops: false // not supported
|
2025-01-14 21:14:49 +00:00
|
|
|
, language: 'en' // language to get results in
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Response
|
|
|
|
|
|
|
|
|
|
|
|
```js
|
2025-01-14 22:16:09 +00:00
|
|
|
import {createClient} from 'db-vendo-client'
|
2025-01-14 22:35:19 +00:00
|
|
|
import {profile as dbnavProfile} from 'db-vendo-client/p/dbnav/index.js'
|
2025-01-14 21:14:49 +00:00
|
|
|
|
|
|
|
const userAgent = 'link-to-your-project-or-email' // adapt this to your project!
|
2025-01-14 22:35:19 +00:00
|
|
|
const client = createClient(dbnavProfile, userAgent)
|
2025-01-14 21:14:49 +00:00
|
|
|
|
|
|
|
await client.locations('Alexanderplatz', {results: 3})
|
|
|
|
```
|
|
|
|
|
|
|
|
The result may look like this:
|
|
|
|
|
|
|
|
```js
|
|
|
|
[ {
|
|
|
|
type: 'stop',
|
|
|
|
id: '900000100003',
|
|
|
|
name: 'S+U Alexanderplatz',
|
|
|
|
location: {
|
|
|
|
type: 'location',
|
|
|
|
latitude: 52.521508,
|
|
|
|
longitude: 13.411267
|
|
|
|
},
|
|
|
|
products: {
|
|
|
|
suburban: true,
|
|
|
|
subway: true,
|
|
|
|
tram: true,
|
|
|
|
bus: true,
|
|
|
|
ferry: false,
|
|
|
|
express: false,
|
|
|
|
regional: true
|
|
|
|
}
|
|
|
|
}, { // point of interest
|
|
|
|
type: 'location',
|
|
|
|
id: '900980709',
|
|
|
|
poi: true,
|
|
|
|
name: 'Berlin, Holiday Inn Centre Alexanderplatz****',
|
|
|
|
latitude: 52.523549,
|
|
|
|
longitude: 13.418441
|
|
|
|
}, { // point of interest
|
|
|
|
type: 'location',
|
|
|
|
id: '900980176',
|
|
|
|
poi: true,
|
|
|
|
name: 'Berlin, Hotel Agon am Alexanderplatz',
|
|
|
|
latitude: 52.524556,
|
|
|
|
longitude: 13.420266
|
|
|
|
} ]
|
|
|
|
```
|