mobility-toolbox-js 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mbt.js +62 -57
- package/mbt.js.map +2 -2
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +3 -3
- package/ol/controls/RoutingControl.d.ts +13 -13
- package/ol/controls/RoutingControl.js +64 -48
- package/ol/layers/RealtimeLayer.js +2 -8
- package/package.json +2 -2
- package/types/routing.d.ts +63 -63
- package/types/stops.d.ts +65 -65
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Map, MapBrowserEvent } from 'ol';
|
|
2
|
+
import type { Coordinate } from 'ol/coordinate';
|
|
3
|
+
import type { StyleLike } from 'ol/style/Style';
|
|
1
4
|
import { Feature } from 'ol';
|
|
2
5
|
import Control, { Options } from 'ol/control/Control';
|
|
3
6
|
import { EventsKey } from 'ol/events';
|
|
@@ -7,11 +10,9 @@ import { Modify } from 'ol/interaction';
|
|
|
7
10
|
import { ModifyEvent } from 'ol/interaction/Modify';
|
|
8
11
|
import VectorLayer from 'ol/layer/Vector';
|
|
9
12
|
import VectorSource from 'ol/source/Vector';
|
|
10
|
-
import { RoutingAPI } from '../../api';
|
|
11
|
-
import type { Map, MapBrowserEvent } from 'ol';
|
|
12
|
-
import type { Coordinate } from 'ol/coordinate';
|
|
13
|
-
import type { StyleLike } from 'ol/style/Style';
|
|
14
13
|
import type { RoutingGraph, RoutingMot, RoutingParameters, RoutingViaPoint } from '../../types';
|
|
14
|
+
import { RoutingAPI } from '../../api';
|
|
15
|
+
export type AbortControllersByGraph = Record<string, AbortController>;
|
|
15
16
|
export type RoutingControlOptions = {
|
|
16
17
|
active?: boolean;
|
|
17
18
|
apiKey?: string;
|
|
@@ -27,7 +28,6 @@ export type RoutingControlOptions = {
|
|
|
27
28
|
style?: StyleLike;
|
|
28
29
|
useRawViaPoints?: boolean;
|
|
29
30
|
} & Options;
|
|
30
|
-
export type AbortControllersByGraph = Record<string, AbortController>;
|
|
31
31
|
/**
|
|
32
32
|
* This OpenLayers control allows the user to add and modifiy via points to
|
|
33
33
|
* a map and request a route from the [geOps Routing API](https://developer.geops.io/apis/routing/).
|
|
@@ -79,6 +79,14 @@ declare class RoutingControl extends Control {
|
|
|
79
79
|
stopsApiUrl?: string;
|
|
80
80
|
useRawViaPoints: boolean;
|
|
81
81
|
viaPoints: RoutingViaPoint[];
|
|
82
|
+
get active(): boolean;
|
|
83
|
+
set active(newValue: boolean);
|
|
84
|
+
get loading(): boolean;
|
|
85
|
+
set loading(newValue: boolean);
|
|
86
|
+
get modify(): any;
|
|
87
|
+
set modify(newValue: any);
|
|
88
|
+
get mot(): RoutingMot;
|
|
89
|
+
set mot(newValue: RoutingMot);
|
|
82
90
|
/**
|
|
83
91
|
* Constructor.
|
|
84
92
|
*
|
|
@@ -201,13 +209,5 @@ declare class RoutingControl extends Control {
|
|
|
201
209
|
* @public
|
|
202
210
|
*/
|
|
203
211
|
setViaPoints(coordinateArray: Coordinate[]): void;
|
|
204
|
-
get active(): boolean;
|
|
205
|
-
set active(newValue: boolean);
|
|
206
|
-
get loading(): boolean;
|
|
207
|
-
set loading(newValue: boolean);
|
|
208
|
-
get modify(): any;
|
|
209
|
-
set modify(newValue: any);
|
|
210
|
-
get mot(): RoutingMot;
|
|
211
|
-
set mot(newValue: RoutingMot);
|
|
212
212
|
}
|
|
213
213
|
export default RoutingControl;
|
|
@@ -68,6 +68,30 @@ const getFlatCoordinatesFromSegments = (segmentArray) => {
|
|
|
68
68
|
* @public
|
|
69
69
|
*/
|
|
70
70
|
class RoutingControl extends Control {
|
|
71
|
+
get active() {
|
|
72
|
+
return this.get('active');
|
|
73
|
+
}
|
|
74
|
+
set active(newValue) {
|
|
75
|
+
this.set('active', newValue);
|
|
76
|
+
}
|
|
77
|
+
get loading() {
|
|
78
|
+
return this.get('loading');
|
|
79
|
+
}
|
|
80
|
+
set loading(newValue) {
|
|
81
|
+
this.set('loading', newValue);
|
|
82
|
+
}
|
|
83
|
+
get modify() {
|
|
84
|
+
return this.get('modify');
|
|
85
|
+
}
|
|
86
|
+
set modify(newValue) {
|
|
87
|
+
this.set('modify', newValue);
|
|
88
|
+
}
|
|
89
|
+
get mot() {
|
|
90
|
+
return this.get('mot');
|
|
91
|
+
}
|
|
92
|
+
set mot(newValue) {
|
|
93
|
+
this.set('mot', newValue);
|
|
94
|
+
}
|
|
71
95
|
/**
|
|
72
96
|
* Constructor.
|
|
73
97
|
*
|
|
@@ -122,7 +146,6 @@ class RoutingControl extends Control {
|
|
|
122
146
|
((error) => {
|
|
123
147
|
this.dispatchEvent(new BaseEvent('change:route'));
|
|
124
148
|
this.reset();
|
|
125
|
-
// eslint-disable-next-line no-console
|
|
126
149
|
console.error(error);
|
|
127
150
|
});
|
|
128
151
|
this.onMapClick = this.onMapClick.bind(this);
|
|
@@ -147,10 +170,12 @@ class RoutingControl extends Control {
|
|
|
147
170
|
*/
|
|
148
171
|
static getGraphsResolutions(graphs, map) {
|
|
149
172
|
const view = map.getView();
|
|
150
|
-
return graphs.map(([, minZoom, maxZoom]) =>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
173
|
+
return graphs.map(([, minZoom, maxZoom]) => {
|
|
174
|
+
return [
|
|
175
|
+
view.getResolutionForZoom(minZoom),
|
|
176
|
+
view.getResolutionForZoom(maxZoom || minZoom + 1),
|
|
177
|
+
];
|
|
178
|
+
});
|
|
154
179
|
}
|
|
155
180
|
/**
|
|
156
181
|
* Aborts viapoint and route requests
|
|
@@ -231,7 +256,9 @@ class RoutingControl extends Control {
|
|
|
231
256
|
this.element = document.createElement('button');
|
|
232
257
|
this.element.id = 'ol-toggle-routing';
|
|
233
258
|
this.element.innerHTML = 'Toggle Route Control';
|
|
234
|
-
this.element.onclick = () =>
|
|
259
|
+
this.element.onclick = () => {
|
|
260
|
+
return this.active ? this.deactivate() : this.activate();
|
|
261
|
+
};
|
|
235
262
|
Object.assign(this.element.style, {
|
|
236
263
|
position: 'absolute',
|
|
237
264
|
right: '10px',
|
|
@@ -256,7 +283,10 @@ class RoutingControl extends Control {
|
|
|
256
283
|
const feats = ((_a = e.target) === null || _a === void 0 ? void 0 : _a.getFeaturesAtPixel(e.pixel, {
|
|
257
284
|
hitTolerance: 5,
|
|
258
285
|
})) || [];
|
|
259
|
-
const viaPoint = feats.find((feat) => {
|
|
286
|
+
const viaPoint = feats.find((feat) => {
|
|
287
|
+
var _a;
|
|
288
|
+
return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'Point' && feat.get('index');
|
|
289
|
+
});
|
|
260
290
|
if (click(e) && viaPoint) {
|
|
261
291
|
// Remove node & viaPoint if an existing viaPoint was clicked
|
|
262
292
|
this.removeViaPoint(viaPoint.get('index'));
|
|
@@ -325,9 +355,7 @@ class RoutingControl extends Control {
|
|
|
325
355
|
return Promise.resolve([]);
|
|
326
356
|
}
|
|
327
357
|
return this.api
|
|
328
|
-
.route(Object.assign({ 'coord-punish': 1000.0, 'coord-radius': 100.0,
|
|
329
|
-
// @ts-expect-error missing property in swagger
|
|
330
|
-
elevation: false, graph, mot: this.mot, 'resolve-hops': false, via: `${formattedViaPoints.join('|')}` }, (this.apiParams || {})), { signal })
|
|
358
|
+
.route(Object.assign({ 'coord-punish': 1000.0, 'coord-radius': 100.0, elevation: false, graph, mot: this.mot, 'resolve-hops': false, via: `${formattedViaPoints.join('|')}` }, (this.apiParams || {})), { signal })
|
|
331
359
|
.then((featureCollection) => {
|
|
332
360
|
var _a, _b, _c;
|
|
333
361
|
this.segments = this.format.readFeatures(featureCollection);
|
|
@@ -335,7 +363,9 @@ class RoutingControl extends Control {
|
|
|
335
363
|
// Extract unique values from viaPoint target value
|
|
336
364
|
const uniqueVias = this.segments.reduce((resultVias, currentFeat) => {
|
|
337
365
|
const segTrg = currentFeat.get('trg');
|
|
338
|
-
return resultVias.find((via) =>
|
|
366
|
+
return resultVias.find((via) => {
|
|
367
|
+
return via[0] === segTrg[0] && via[1] === segTrg[1];
|
|
368
|
+
})
|
|
339
369
|
? resultVias
|
|
340
370
|
: [...resultVias, segTrg];
|
|
341
371
|
}, []);
|
|
@@ -409,7 +439,9 @@ class RoutingControl extends Control {
|
|
|
409
439
|
[stationId, track] = viaPoint.split('$');
|
|
410
440
|
}
|
|
411
441
|
return fetch(`${this.stopsApiUrl}lookup/${stationId}?key=${this.stopsApiKey}`, { signal: abortController.signal })
|
|
412
|
-
.then((res) =>
|
|
442
|
+
.then((res) => {
|
|
443
|
+
return res.json();
|
|
444
|
+
})
|
|
413
445
|
.then((stationData) => {
|
|
414
446
|
var _a, _b, _c, _d;
|
|
415
447
|
const { coordinates } = ((_b = (_a = stationData === null || stationData === void 0 ? void 0 : stationData.features) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.geometry) || {};
|
|
@@ -468,7 +500,9 @@ class RoutingControl extends Control {
|
|
|
468
500
|
}
|
|
469
501
|
if (stationName) {
|
|
470
502
|
return fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${stationName}&limit=1`, { signal: abortController.signal })
|
|
471
|
-
.then((res) =>
|
|
503
|
+
.then((res) => {
|
|
504
|
+
return res.json();
|
|
505
|
+
})
|
|
472
506
|
.then((stationData) => {
|
|
473
507
|
var _a, _b;
|
|
474
508
|
const { coordinates } = stationData.features[0].geometry;
|
|
@@ -510,12 +544,14 @@ class RoutingControl extends Control {
|
|
|
510
544
|
onMapClick(evt) {
|
|
511
545
|
const feats = evt.target.getFeaturesAtPixel(evt.pixel, {
|
|
512
546
|
hitTolerance: 5,
|
|
513
|
-
layerFilter: (layer) =>
|
|
547
|
+
layerFilter: (layer) => {
|
|
548
|
+
return layer === this.routingLayer;
|
|
549
|
+
},
|
|
514
550
|
});
|
|
515
551
|
const viaPoint = feats.find((feat) => {
|
|
516
552
|
var _a;
|
|
517
|
-
return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'Point' &&
|
|
518
|
-
feat.get('viaPointIdx') !== undefined;
|
|
553
|
+
return (((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'Point' &&
|
|
554
|
+
feat.get('viaPointIdx') !== undefined);
|
|
519
555
|
});
|
|
520
556
|
if (viaPoint) {
|
|
521
557
|
// Remove existing viaPoint on click and abort viaPoint add
|
|
@@ -557,22 +593,26 @@ class RoutingControl extends Control {
|
|
|
557
593
|
var _a;
|
|
558
594
|
// When modify start, we search the index of the segment that is modifying.
|
|
559
595
|
let segmentIndex = -1;
|
|
560
|
-
const route = evt.features
|
|
561
|
-
|
|
562
|
-
|
|
596
|
+
const route = evt.features.getArray().find((feat) => {
|
|
597
|
+
var _a;
|
|
598
|
+
return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'LineString';
|
|
599
|
+
});
|
|
563
600
|
// Find the segment index that is being modified
|
|
564
601
|
if ((route === null || route === void 0 ? void 0 : route.getGeometry()) && evt.mapBrowserEvent.coordinate) {
|
|
565
602
|
// We use a buff extent to fix floating issues , see https://github.com/openlayers/openlayers/issues/7130#issuecomment-535856422
|
|
566
603
|
const closestExtent = buffer(new Point(
|
|
567
604
|
// @ts-expect-error bad def
|
|
568
605
|
(_a = route.getGeometry()) === null || _a === void 0 ? void 0 : _a.getClosestPoint(evt.mapBrowserEvent.coordinate)).getExtent(), 0.001);
|
|
569
|
-
segmentIndex = this.segments.findIndex((segment) => {
|
|
606
|
+
segmentIndex = this.segments.findIndex((segment) => {
|
|
607
|
+
var _a;
|
|
608
|
+
return (_a = segment.getGeometry()) === null || _a === void 0 ? void 0 : _a.intersectsExtent(closestExtent);
|
|
609
|
+
});
|
|
570
610
|
}
|
|
571
611
|
// Find the viaPoint that is being modified
|
|
572
|
-
const viaPoint = (evt.features
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
612
|
+
const viaPoint = (evt.features.getArray().filter((feat) => {
|
|
613
|
+
var _a;
|
|
614
|
+
return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'Point';
|
|
615
|
+
}) || [])[0];
|
|
576
616
|
// Write object with modify info
|
|
577
617
|
this.initialRouteDrag = {
|
|
578
618
|
oldRoute: route === null || route === void 0 ? void 0 : route.clone(),
|
|
@@ -635,29 +675,5 @@ class RoutingControl extends Control {
|
|
|
635
675
|
this.drawRoute();
|
|
636
676
|
this.dispatchEvent(new BaseEvent('change:route'));
|
|
637
677
|
}
|
|
638
|
-
get active() {
|
|
639
|
-
return this.get('active');
|
|
640
|
-
}
|
|
641
|
-
set active(newValue) {
|
|
642
|
-
this.set('active', newValue);
|
|
643
|
-
}
|
|
644
|
-
get loading() {
|
|
645
|
-
return this.get('loading');
|
|
646
|
-
}
|
|
647
|
-
set loading(newValue) {
|
|
648
|
-
this.set('loading', newValue);
|
|
649
|
-
}
|
|
650
|
-
get modify() {
|
|
651
|
-
return this.get('modify');
|
|
652
|
-
}
|
|
653
|
-
set modify(newValue) {
|
|
654
|
-
this.set('modify', newValue);
|
|
655
|
-
}
|
|
656
|
-
get mot() {
|
|
657
|
-
return this.get('mot');
|
|
658
|
-
}
|
|
659
|
-
set mot(newValue) {
|
|
660
|
-
this.set('mot', newValue);
|
|
661
|
-
}
|
|
662
678
|
}
|
|
663
679
|
export default RoutingControl;
|
|
@@ -269,15 +269,8 @@ class RealtimeLayer extends Layer {
|
|
|
269
269
|
highlightTrajectory(id) {
|
|
270
270
|
return __awaiter(this, void 0, void 0, function* () {
|
|
271
271
|
var _a, _b, _c, _d, _e, _f;
|
|
272
|
-
if (!id) {
|
|
273
|
-
this.cleanVectorLayer();
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
272
|
const features = yield this.getFullTrajectory(id);
|
|
277
|
-
|
|
278
|
-
this.cleanVectorLayer();
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
273
|
+
this.cleanVectorLayer();
|
|
281
274
|
if (features.length) {
|
|
282
275
|
(_b = (_a = this.vectorLayer) === null || _a === void 0 ? void 0 : _a.getSource()) === null || _b === void 0 ? void 0 : _b.addFeatures(features);
|
|
283
276
|
}
|
|
@@ -334,6 +327,7 @@ class RealtimeLayer extends Layer {
|
|
|
334
327
|
select(feature) {
|
|
335
328
|
const id = feature === null || feature === void 0 ? void 0 : feature.get('train_id');
|
|
336
329
|
if (this.selectedVehicleId !== id) {
|
|
330
|
+
this.cleanVectorLayer();
|
|
337
331
|
this.selectedVehicleId = id;
|
|
338
332
|
this.engine.renderTrajectories(true);
|
|
339
333
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mobility-toolbox-js",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
|
|
5
|
-
"version": "3.2.
|
|
5
|
+
"version": "3.2.1",
|
|
6
6
|
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"next": "15.1.6",
|
|
64
64
|
"next-transpile-modules": "10.0.1",
|
|
65
65
|
"ol": "10.4.0",
|
|
66
|
-
"openapi-typescript": "
|
|
66
|
+
"openapi-typescript": "5",
|
|
67
67
|
"prettier": "3.4.2",
|
|
68
68
|
"raw-loader": "4.0.2",
|
|
69
69
|
"sort-json": "2.0.1",
|
package/types/routing.d.ts
CHANGED
|
@@ -3,64 +3,12 @@
|
|
|
3
3
|
* Do not make direct changes to the file.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface paths {
|
|
7
7
|
'/': {
|
|
8
8
|
/** Returns a route as GeoJSON */
|
|
9
9
|
get: {
|
|
10
10
|
parameters: {
|
|
11
11
|
query: {
|
|
12
|
-
/**
|
|
13
|
-
* Whether to use beelines (line strings with 2 points) between
|
|
14
|
-
* mutually unreachable hops as a fallback for "Route not found"
|
|
15
|
-
* errors. "true", "on", "yes", "y", "1" will enable the
|
|
16
|
-
* fallback. Default: enabled
|
|
17
|
-
*/
|
|
18
|
-
'beeline-fallback'?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Distance punishment factor for edge snapping of coordinates (see
|
|
21
|
-
* "Note on coordinates" at the top). Large: prefer close edge. Small:
|
|
22
|
-
* prefer short total route. Negative value: like worst edge
|
|
23
|
-
* category. Default: -1.0
|
|
24
|
-
*/
|
|
25
|
-
'coord-punish'?: number;
|
|
26
|
-
/**
|
|
27
|
-
* Search radius for candidate edges during snapping of coordinates
|
|
28
|
-
* (see "Note on coordinates" at the top) Default: -1.0
|
|
29
|
-
*/
|
|
30
|
-
'coord-radius'?: number;
|
|
31
|
-
/** Only for mot=rail. Default is a detailed network based on OpenStreetMap. gen1 to gen4 provide rail networks with increasing levels of generalization */
|
|
32
|
-
graph?: 'gen1' | 'gen2' | 'gen3' | 'gen4';
|
|
33
|
-
/**
|
|
34
|
-
* Whether to include intermediate hops (stations/stops) found on the
|
|
35
|
-
* route to the response. "true", "on", "yes", "y", "1" will enable
|
|
36
|
-
* intermediate hops. Default: disabled
|
|
37
|
-
*/
|
|
38
|
-
hops?: string;
|
|
39
|
-
/** A line name that should be preferred */
|
|
40
|
-
line?: string;
|
|
41
|
-
/** Name of origin of the preferred line */
|
|
42
|
-
'line-from'?: string;
|
|
43
|
-
/** Name of destination of the preferred line */
|
|
44
|
-
'line-to'?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Maximum allowed ratio of hops to skip if not found. Only non-start
|
|
47
|
-
* and non-end hops are counted in ratio numerator and denominator.
|
|
48
|
-
*/
|
|
49
|
-
'max-skip-hop-ratio'?: number;
|
|
50
|
-
/** Mode of transport */
|
|
51
|
-
mot:
|
|
52
|
-
| 'bus'
|
|
53
|
-
| 'car'
|
|
54
|
-
| 'coach'
|
|
55
|
-
| 'ferry'
|
|
56
|
-
| 'foot'
|
|
57
|
-
| 'funicular'
|
|
58
|
-
| 'gondola'
|
|
59
|
-
| 'rail'
|
|
60
|
-
| 'subway'
|
|
61
|
-
| 'tram';
|
|
62
|
-
/** Douglas-Peucker distance parameter for simplification. Default 0.5 in Mercator units */
|
|
63
|
-
simplify?: number;
|
|
64
12
|
/**
|
|
65
13
|
* A pipe separated list of hops. A hop describes a station with either
|
|
66
14
|
* - a name or abbreviation
|
|
@@ -104,6 +52,58 @@ export interface Paths {
|
|
|
104
52
|
* - `freiburg|basel%20sbb|bern` - from Freiburg (Breisgau) Hbf via Basel SBB to Bern
|
|
105
53
|
*/
|
|
106
54
|
via: string;
|
|
55
|
+
/** Mode of transport */
|
|
56
|
+
mot:
|
|
57
|
+
| 'rail'
|
|
58
|
+
| 'bus'
|
|
59
|
+
| 'coach'
|
|
60
|
+
| 'foot'
|
|
61
|
+
| 'tram'
|
|
62
|
+
| 'subway'
|
|
63
|
+
| 'gondola'
|
|
64
|
+
| 'funicular'
|
|
65
|
+
| 'ferry'
|
|
66
|
+
| 'car';
|
|
67
|
+
/** Only for mot=rail. Default is a detailed network based on OpenStreetMap. gen1 to gen4 provide rail networks with increasing levels of generalization */
|
|
68
|
+
graph?: 'gen1' | 'gen2' | 'gen3' | 'gen4';
|
|
69
|
+
/** A line name that should be preferred */
|
|
70
|
+
line?: string;
|
|
71
|
+
/** Name of origin of the preferred line */
|
|
72
|
+
'line-from'?: string;
|
|
73
|
+
/** Name of destination of the preferred line */
|
|
74
|
+
'line-to'?: string;
|
|
75
|
+
/** Douglas-Peucker distance parameter for simplification. Default 0.5 in Mercator units */
|
|
76
|
+
simplify?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Maximum allowed ratio of hops to skip if not found. Only non-start
|
|
79
|
+
* and non-end hops are counted in ratio numerator and denominator.
|
|
80
|
+
*/
|
|
81
|
+
'max-skip-hop-ratio'?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Whether to include intermediate hops (stations/stops) found on the
|
|
84
|
+
* route to the response. "true", "on", "yes", "y", "1" will enable
|
|
85
|
+
* intermediate hops. Default: disabled
|
|
86
|
+
*/
|
|
87
|
+
hops?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Whether to use beelines (line strings with 2 points) between
|
|
90
|
+
* mutually unreachable hops as a fallback for "Route not found"
|
|
91
|
+
* errors. "true", "on", "yes", "y", "1" will enable the
|
|
92
|
+
* fallback. Default: enabled
|
|
93
|
+
*/
|
|
94
|
+
'beeline-fallback'?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Search radius for candidate edges during snapping of coordinates
|
|
97
|
+
* (see "Note on coordinates" at the top) Default: -1.0
|
|
98
|
+
*/
|
|
99
|
+
'coord-radius'?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Distance punishment factor for edge snapping of coordinates (see
|
|
102
|
+
* "Note on coordinates" at the top). Large: prefer close edge. Small:
|
|
103
|
+
* prefer short total route. Negative value: like worst edge
|
|
104
|
+
* category. Default: -1.0
|
|
105
|
+
*/
|
|
106
|
+
'coord-punish'?: number;
|
|
107
107
|
/**
|
|
108
108
|
* Whether to output OSM way ids in Feature properties.
|
|
109
109
|
* "true", "on", "yes", "y", "1" will enable output. Default: disabled
|
|
@@ -147,14 +147,14 @@ export interface Paths {
|
|
|
147
147
|
* @example
|
|
148
148
|
*/
|
|
149
149
|
id?: string;
|
|
150
|
-
/** @description Latitude of the stop, in WGS84 */
|
|
151
|
-
latitude?: number;
|
|
152
|
-
/** @description Latitude of the stop, in WGS84 */
|
|
153
|
-
longitude?: number;
|
|
154
150
|
/** @example Freiburg Littenweiler */
|
|
155
151
|
name?: string;
|
|
156
152
|
/** @example 1 */
|
|
157
153
|
platform?: string;
|
|
154
|
+
/** @description Latitude of the stop, in WGS84 */
|
|
155
|
+
latitude?: number;
|
|
156
|
+
/** @description Latitude of the stop, in WGS84 */
|
|
157
|
+
longitude?: number;
|
|
158
158
|
};
|
|
159
159
|
station_to?: {
|
|
160
160
|
/**
|
|
@@ -162,14 +162,14 @@ export interface Paths {
|
|
|
162
162
|
* @example 8004158
|
|
163
163
|
*/
|
|
164
164
|
id?: string;
|
|
165
|
-
/** @description Latitude of the stop, in WGS84 */
|
|
166
|
-
latitude?: number;
|
|
167
|
-
/** @description Latitude of the stop, in WGS84 */
|
|
168
|
-
longitude?: number;
|
|
169
165
|
/** @example Muenchen Pasing */
|
|
170
166
|
name?: string;
|
|
171
167
|
/** @example 4 */
|
|
172
168
|
platform?: string;
|
|
169
|
+
/** @description Latitude of the stop, in WGS84 */
|
|
170
|
+
latitude?: number;
|
|
171
|
+
/** @description Latitude of the stop, in WGS84 */
|
|
172
|
+
longitude?: number;
|
|
173
173
|
};
|
|
174
174
|
/** @enum {string} */
|
|
175
175
|
type?: 'Feature';
|
|
@@ -201,6 +201,6 @@ export interface Paths {
|
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
export interface
|
|
204
|
+
export interface operations {}
|
|
205
205
|
|
|
206
|
-
export interface
|
|
206
|
+
export interface external {}
|
package/types/stops.d.ts
CHANGED
|
@@ -3,41 +3,41 @@
|
|
|
3
3
|
* Do not make direct changes to the file.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface paths {
|
|
7
7
|
'/': {
|
|
8
8
|
/** Returns a stop (or multiple) as GeoJSON FeatureCollection */
|
|
9
9
|
get: {
|
|
10
10
|
parameters: {
|
|
11
11
|
query: {
|
|
12
|
-
/**
|
|
13
|
-
* left,bottom,right,up coordinates in WGS84 wherein the
|
|
14
|
-
* station should lie
|
|
15
|
-
*/
|
|
16
|
-
bbox?: string;
|
|
17
|
-
/** which field to look up, default: all of them */
|
|
18
|
-
field?: 'coords' | 'id' | 'name';
|
|
19
12
|
/** Control how many matches will be returned */
|
|
20
13
|
limit?: number;
|
|
14
|
+
/** Anything you'd like to search for */
|
|
15
|
+
q: string;
|
|
16
|
+
/**
|
|
17
|
+
* comma seperated list, order chooses which agency will be preferred
|
|
18
|
+
* as ident_source (for id and code fields)
|
|
19
|
+
*/
|
|
20
|
+
prefagencies?: 'sbb' | 'db';
|
|
21
21
|
/**
|
|
22
22
|
* comma seperated list of mot's which should be available
|
|
23
23
|
* at the stop
|
|
24
24
|
*/
|
|
25
25
|
mots?:
|
|
26
26
|
| 'bus'
|
|
27
|
-
| 'cable_car'
|
|
28
27
|
| 'ferry'
|
|
29
|
-
| 'funicular'
|
|
30
28
|
| 'gondola'
|
|
29
|
+
| 'tram'
|
|
31
30
|
| 'rail'
|
|
32
|
-
| '
|
|
33
|
-
| '
|
|
31
|
+
| 'funicular'
|
|
32
|
+
| 'cable_car'
|
|
33
|
+
| 'subway';
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* left,bottom,right,up coordinates in WGS84 wherein the
|
|
36
|
+
* station should lie
|
|
37
37
|
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
|
|
38
|
+
bbox?: string;
|
|
39
|
+
/** which field to look up, default: all of them */
|
|
40
|
+
field?: 'id' | 'name' | 'coords';
|
|
41
41
|
/**
|
|
42
42
|
* Coordinates in WGS84 (in lat,lon order) used to rank stops close to
|
|
43
43
|
* this position higher
|
|
@@ -49,81 +49,81 @@ export interface Paths {
|
|
|
49
49
|
/** stop(s) */
|
|
50
50
|
200: {
|
|
51
51
|
schema: {
|
|
52
|
+
/** @enum {string} */
|
|
53
|
+
type?: 'FeatureCollection';
|
|
52
54
|
features?: {
|
|
53
|
-
/** @
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @example [
|
|
57
|
-
* 7.439119,
|
|
58
|
-
* 46.94882
|
|
59
|
-
* ]
|
|
60
|
-
*/
|
|
61
|
-
coordinates?: number[];
|
|
62
|
-
/** @enum {string} */
|
|
63
|
-
type?: 'Point';
|
|
64
|
-
};
|
|
55
|
+
/** @enum {string} */
|
|
56
|
+
type?: 'Feature';
|
|
65
57
|
properties?: {
|
|
58
|
+
/** @description internal ID */
|
|
59
|
+
uid?: string;
|
|
66
60
|
/**
|
|
67
|
-
* @description
|
|
68
|
-
*
|
|
69
|
-
* @example BN
|
|
61
|
+
* @description name of the stop
|
|
62
|
+
* @example Bern
|
|
70
63
|
*/
|
|
71
|
-
|
|
64
|
+
name?: string;
|
|
72
65
|
/**
|
|
73
66
|
* @description 2 letter country code where the station is located
|
|
74
67
|
* @example CH
|
|
75
68
|
*/
|
|
76
69
|
country_code?: string;
|
|
77
70
|
/**
|
|
78
|
-
* @description
|
|
79
|
-
*
|
|
71
|
+
* @description how well the result matches your query, 0
|
|
72
|
+
* means best
|
|
80
73
|
*/
|
|
81
|
-
|
|
74
|
+
rank?: number;
|
|
82
75
|
/**
|
|
83
|
-
* @description
|
|
84
|
-
* @
|
|
76
|
+
* @description array of translations of the stopname
|
|
77
|
+
* @default []
|
|
85
78
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
translated_names?: {
|
|
80
|
+
value?: string;
|
|
81
|
+
/** @enum {string} */
|
|
82
|
+
language?: 'de' | 'en' | 'fr' | 'it';
|
|
83
|
+
}[];
|
|
89
84
|
/** @description Means of transport that are available at this station */
|
|
90
85
|
mot?: {
|
|
91
86
|
bus?: boolean;
|
|
92
|
-
cable_car?: boolean;
|
|
93
87
|
ferry?: boolean;
|
|
94
|
-
funicular?: boolean;
|
|
95
88
|
gondola?: boolean;
|
|
89
|
+
tram?: boolean;
|
|
96
90
|
rail?: boolean;
|
|
91
|
+
funicular?: boolean;
|
|
92
|
+
cable_car?: boolean;
|
|
97
93
|
subway?: boolean;
|
|
98
|
-
tram?: boolean;
|
|
99
94
|
};
|
|
100
95
|
/**
|
|
101
|
-
* @description
|
|
102
|
-
* @example
|
|
96
|
+
* @description source agency for id and code (see below)
|
|
97
|
+
* @example sbb
|
|
103
98
|
*/
|
|
104
|
-
|
|
99
|
+
ident_source?: string;
|
|
105
100
|
/**
|
|
106
|
-
* @description
|
|
107
|
-
*
|
|
101
|
+
* @description uic number
|
|
102
|
+
* @example 8507000
|
|
108
103
|
*/
|
|
109
|
-
|
|
104
|
+
id?: string;
|
|
110
105
|
/**
|
|
111
|
-
* @description
|
|
112
|
-
*
|
|
106
|
+
* @description Abbreviation code from the transport agency (e.g. DS100 for Deutsche Bahn)
|
|
107
|
+
*
|
|
108
|
+
* @example BN
|
|
113
109
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
code?: string;
|
|
111
|
+
/** @description ifopt identifier, if available */
|
|
112
|
+
ifopt?: string;
|
|
113
|
+
};
|
|
114
|
+
/** @description the coordinates of the stop */
|
|
115
|
+
geometry?: {
|
|
116
|
+
/** @enum {string} */
|
|
117
|
+
type?: 'Point';
|
|
118
|
+
/**
|
|
119
|
+
* @example [
|
|
120
|
+
* 7.439119,
|
|
121
|
+
* 46.94882
|
|
122
|
+
* ]
|
|
123
|
+
*/
|
|
124
|
+
coordinates?: number[];
|
|
121
125
|
};
|
|
122
|
-
/** @enum {string} */
|
|
123
|
-
type?: 'Feature';
|
|
124
126
|
}[];
|
|
125
|
-
/** @enum {string} */
|
|
126
|
-
type?: 'FeatureCollection';
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
129
|
/** limit parameter too high */
|
|
@@ -138,6 +138,6 @@ export interface Paths {
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
export interface
|
|
141
|
+
export interface operations {}
|
|
142
142
|
|
|
143
|
-
export interface
|
|
143
|
+
export interface external {}
|