@wemap/routers 12.10.8 → 12.11.0
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/dist/helpers/InstructionManager.d.ts +20 -0
- package/dist/helpers/InstructionManagerV1.d.ts +7 -0
- package/{index.ts → dist/index.d.ts} +1 -11
- package/dist/index.js +1 -5099
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -5
- package/dist/index.mjs.map +1 -1
- package/dist/src/ItineraryInfoManager.d.ts +31 -0
- package/dist/src/RoutingError.d.ts +24 -0
- package/{src/StatusCode.ts → dist/src/StatusCode.d.ts} +2 -3
- package/dist/src/Utils.d.ts +6 -0
- package/dist/src/graph/Edge.d.ts +38 -0
- package/dist/src/graph/Graph.d.ts +40 -0
- package/dist/src/graph/GraphProjection.d.ts +11 -0
- package/dist/src/graph/GraphProjectionOptions.d.ts +7 -0
- package/dist/src/graph/GraphRoute.d.ts +19 -0
- package/dist/src/graph/GraphRouter.d.ts +20 -0
- package/dist/src/graph/GraphRouterEngine.d.ts +80 -0
- package/{src/graph/GraphRouterOptions.ts → dist/src/graph/GraphRouterOptions.d.ts} +6 -7
- package/dist/src/graph/GraphRouterOptionsBuilder.d.ts +23 -0
- package/dist/src/graph/GraphRouterOptionsFactors.d.ts +8 -0
- package/dist/src/graph/NoRouteFoundError.d.ts +12 -0
- package/dist/src/graph/Vertex.d.ts +19 -0
- package/dist/src/model/Itinerary.d.ts +81 -0
- package/dist/src/model/Leg.d.ts +66 -0
- package/dist/src/model/LevelChange.d.ts +7 -0
- package/dist/src/model/RouterRequest.d.ts +42 -0
- package/dist/src/model/Step.d.ts +42 -0
- package/dist/src/model/StepExtra.d.ts +3 -0
- package/dist/src/model/StepsBuilder.d.ts +16 -0
- package/dist/src/model/TransitMode.d.ts +5 -0
- package/{src/model/TravelMode.ts → dist/src/model/TravelMode.d.ts} +1 -2
- package/dist/src/model/generateSteps.d.ts +0 -0
- package/{src/remote/RemoteRouter.ts → dist/src/remote/RemoteRouter.d.ts} +2 -7
- package/dist/src/remote/RemoteRouterManager.d.ts +731 -0
- package/dist/src/remote/RemoteRouterUtils.d.ts +6 -0
- package/dist/src/remote/cityway/CitywayRemoteRouter.d.ts +109 -0
- package/dist/src/remote/deutsche-bahn/DeutscheBahnRemoteRouter.d.ts +31 -0
- package/dist/src/remote/geovelo/GeoveloRemoteRouter.d.ts +106 -0
- package/dist/src/remote/idfm/IdfmRemoteRouter.d.ts +123 -0
- package/dist/src/remote/navitia/NavitiaRemoteRouter.d.ts +34 -0
- package/dist/src/remote/navitia/types.d.ts +87 -0
- package/dist/src/remote/osrm/OsrmRemoteRouter.d.ts +70 -0
- package/dist/src/remote/otp/OtpRemoteRouter.d.ts +69 -0
- package/dist/src/remote/wemap-multi/WemapMultiRemoteRouter.d.ts +19 -0
- package/dist/src/types.d.ts +31 -0
- package/dist/src/wemap-multi/CustomGraphMap.d.ts +56 -0
- package/dist/src/wemap-multi/CustomGraphMapTester.d.ts +39 -0
- package/dist/src/wemap-multi/WemapMultiRouter.d.ts +14 -0
- package/dist/src/wemap-osm/OsmGraphUtils.d.ts +11 -0
- package/dist/tests/CommonTest.d.ts +8 -0
- package/package.json +11 -8
- package/assets/biocbon-bergere-rdc-network.osm +0 -163
- package/assets/bureaux-wemap-montpellier-network.osm +0 -174
- package/assets/components.osm +0 -146
- package/assets/elevator-models-4.osm +0 -89
- package/assets/elevator-models.osm +0 -354
- package/assets/exit-graph.osm +0 -25
- package/assets/gare-de-lest-network-pp-bounds.osm +0 -1613
- package/assets/gare-de-lyon-extract.osm +0 -174
- package/assets/geovelo-montpellier.json +0 -1144
- package/assets/horizontal-elevator.osm +0 -12
- package/assets/itinerary-deutsche-bahn-1.json +0 -368
- package/assets/itinerary-grenoble-otp-1.json +0 -1536
- package/assets/itinerary-grenoble-otp-2.json +0 -1092
- package/assets/itinerary-info-two-points-proj.osm +0 -39
- package/assets/itinerary-info-two-points.osm +0 -24
- package/assets/itinerary-lehavre-cityway-1.json +0 -6799
- package/assets/itinerary-lehavre-cityway-2.json +0 -2133
- package/assets/itinerary-lehavre-cityway-3.json +0 -12577
- package/assets/itinerary-lehavre-cityway-4.json +0 -1451
- package/assets/itinerary-lehavre-cityway-5.json +0 -5925
- package/assets/itinerary-lemans-navitia.json +0 -7768
- package/assets/itinerary-montpellier-osrm-3.json +0 -185
- package/assets/itinerary-montpellier-outdoor-without-steps.json +0 -110
- package/assets/itinerary-montpellier-outdoor.json +0 -513
- package/assets/itinerary-paris-idfm-2.json +0 -1838
- package/assets/itinerary-paris-idfm.json +0 -27727
- package/assets/itinerary-step-not-on-path-osrm.json +0 -457
- package/assets/itinerary-with-duplicate-nodes.json +0 -110
- package/assets/network-conveying-backward.osm +0 -74
- package/assets/network-elevator.osm +0 -48
- package/assets/network-escalators.osm +0 -50
- package/assets/network-simple.osm +0 -27
- package/assets/network-steps-same-level.osm +0 -283
- package/assets/network-with-modifiers.osm +0 -39
- package/assets/one-way.osm +0 -46
- package/assets/report-map-1.osm +0 -36
- package/assets/report-map-2.osm +0 -29
- package/assets/report-map-3.osm +0 -15
- package/assets/rr-wemap-multi-indoor-outdoor-indoor.json +0 -1352
- package/assets/rr-wemap-multi-indoor-outdoor.json +0 -145
- package/assets/rr-wemap-multi-multi-level.json +0 -262
- package/assets/rr-wemap-multi-outdoor-indoor.json +0 -145
- package/assets/rr-wemap-multi-outdoor-outdoor.json +0 -207
- package/assets/rr-wemap-multi-remote-indoor-indoor.json +0 -155
- package/assets/rr-wemap-multi-remote-indoor-outdoor-indoor.json +0 -668
- package/assets/rr-wemap-multi-remote-indoor-outdoor.json +0 -154
- package/assets/rr-wemap-multi-remote-outdoor-indoor.json +0 -179
- package/assets/rr-wemap-multi-remote-outdoor-outdoor.json +0 -109
- package/assets/stairs-and-exit.osm +0 -47
- package/helpers/InstructionManager.ts +0 -184
- package/helpers/InstructionManagerV1.ts +0 -95
- package/src/ItineraryInfoManager.spec.ts +0 -183
- package/src/ItineraryInfoManager.ts +0 -181
- package/src/RoutingError.ts +0 -60
- package/src/Utils.ts +0 -8
- package/src/graph/Edge.spec.ts +0 -32
- package/src/graph/Edge.ts +0 -64
- package/src/graph/Graph.spec.ts +0 -509
- package/src/graph/Graph.ts +0 -272
- package/src/graph/GraphProjection.ts +0 -15
- package/src/graph/GraphProjectionOptions.ts +0 -8
- package/src/graph/GraphRoute.spec.ts +0 -15
- package/src/graph/GraphRoute.ts +0 -43
- package/src/graph/GraphRouter.spec.ts +0 -317
- package/src/graph/GraphRouter.ts +0 -229
- package/src/graph/GraphRouterEngine.ts +0 -248
- package/src/graph/GraphRouterOptionsBuilder.ts +0 -98
- package/src/graph/NoRouteFoundError.ts +0 -39
- package/src/graph/Vertex.spec.ts +0 -42
- package/src/graph/Vertex.ts +0 -45
- package/src/model/Itinerary.spec.ts +0 -134
- package/src/model/Itinerary.ts +0 -370
- package/src/model/Leg.spec.ts +0 -107
- package/src/model/Leg.ts +0 -224
- package/src/model/LevelChange.spec.ts +0 -50
- package/src/model/LevelChange.ts +0 -14
- package/src/model/RouterRequest.ts +0 -33
- package/src/model/Step.spec.ts +0 -99
- package/src/model/Step.ts +0 -90
- package/src/model/StepExtra.ts +0 -1
- package/src/model/StepsBuilder.ts +0 -242
- package/src/model/TransitMode.spec.ts +0 -31
- package/src/model/TransitMode.ts +0 -28
- package/src/model/generateSteps.ts +0 -102
- package/src/remote/RemoteRouterManager.spec.ts +0 -178
- package/src/remote/RemoteRouterManager.ts +0 -72
- package/src/remote/RemoteRouterUtils.ts +0 -25
- package/src/remote/cityway/CitywayRemoteRouter.spec.ts +0 -122
- package/src/remote/cityway/CitywayRemoteRouter.ts +0 -435
- package/src/remote/deutsche-bahn/DeutscheBahnRemoteRouter.spec.ts +0 -52
- package/src/remote/deutsche-bahn/DeutscheBahnRemoteRouter.ts +0 -85
- package/src/remote/geovelo/GeoveloRemoteRouter.spec.ts +0 -54
- package/src/remote/geovelo/GeoveloRemoteRouter.ts +0 -293
- package/src/remote/idfm/IdfmRemoteRouter.spec.ts +0 -102
- package/src/remote/idfm/IdfmRemoteRouter.ts +0 -523
- package/src/remote/navitia/NavitiaRemoteRouter.spec.ts +0 -116
- package/src/remote/navitia/NavitiaRemoteRouter.ts +0 -445
- package/src/remote/navitia/types.ts +0 -73
- package/src/remote/osrm/OsrmRemoteRouter.spec.ts +0 -127
- package/src/remote/osrm/OsrmRemoteRouter.ts +0 -303
- package/src/remote/otp/OtpRemoteRouter.spec.ts +0 -103
- package/src/remote/otp/OtpRemoteRouter.ts +0 -223
- package/src/remote/wemap-multi/WemapMultiRemoteRouter.spec.ts +0 -103
- package/src/remote/wemap-multi/WemapMultiRemoteRouter.ts +0 -56
- package/src/types.ts +0 -32
- package/src/wemap-multi/CustomGraphMap.spec.ts +0 -40
- package/src/wemap-multi/CustomGraphMap.ts +0 -213
- package/src/wemap-multi/CustomGraphMapTester.spec.ts +0 -48
- package/src/wemap-multi/CustomGraphMapTester.ts +0 -90
- package/src/wemap-multi/WemapMultiRouter.spec.ts +0 -138
- package/src/wemap-multi/WemapMultiRouter.ts +0 -329
- package/src/wemap-osm/OsmGraphUtils.spec.ts +0 -165
- package/src/wemap-osm/OsmGraphUtils.ts +0 -173
- package/src/wemap-osm/OsmRouter.elevators.spec.ts +0 -106
- package/src/wemap-osm/OsmRouter.spec.ts +0 -292
- package/tests/CommonTest.ts +0 -78
- package/tsconfig.json +0 -3
- package/vite.config.ts +0 -4
package/dist/index.mjs
CHANGED
|
@@ -2251,6 +2251,68 @@ const ColorUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
2251
2251
|
__proto__: null,
|
|
2252
2252
|
getQualitativeColor
|
|
2253
2253
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2254
|
+
const SPEEDS = {
|
|
2255
|
+
DEFAULT: 4,
|
|
2256
|
+
WHEELCHAIR: 3
|
|
2257
|
+
};
|
|
2258
|
+
const SMOOTHNESS_FACTORS = {
|
|
2259
|
+
wheelchair: {
|
|
2260
|
+
horrible: 0.1,
|
|
2261
|
+
bad: 0.5,
|
|
2262
|
+
intermediate: 0.7,
|
|
2263
|
+
good: 0.9,
|
|
2264
|
+
excellent: 1
|
|
2265
|
+
},
|
|
2266
|
+
default: {
|
|
2267
|
+
horrible: 0.4,
|
|
2268
|
+
bad: 0.7,
|
|
2269
|
+
intermediate: 0.8,
|
|
2270
|
+
good: 0.9,
|
|
2271
|
+
excellent: 1
|
|
2272
|
+
}
|
|
2273
|
+
};
|
|
2274
|
+
const SURFACE_FACTORS = {
|
|
2275
|
+
wheelchair: {
|
|
2276
|
+
asphalt: 1,
|
|
2277
|
+
// Smooth, ideal surface
|
|
2278
|
+
concrete: 1,
|
|
2279
|
+
// Equally good as asphalt
|
|
2280
|
+
paving_stones: 0.8,
|
|
2281
|
+
// Slightly slower due to joints/gaps
|
|
2282
|
+
compacted: 0.7,
|
|
2283
|
+
// Well-compacted surfaces like crushed stone
|
|
2284
|
+
wood: 0.6,
|
|
2285
|
+
// Boardwalks - can be uneven and slippery when wet
|
|
2286
|
+
metal: 0.5,
|
|
2287
|
+
// Metal gratings - challenging for wheels
|
|
2288
|
+
gravel: 0.3,
|
|
2289
|
+
// Very difficult for wheelchairs
|
|
2290
|
+
grass: 0.2,
|
|
2291
|
+
// Very challenging - soft and uneven
|
|
2292
|
+
ground: 0.2
|
|
2293
|
+
// Unpaved/natural ground - very difficult
|
|
2294
|
+
},
|
|
2295
|
+
default: {
|
|
2296
|
+
asphalt: 1,
|
|
2297
|
+
// Ideal walking surface
|
|
2298
|
+
concrete: 1,
|
|
2299
|
+
// Equally good as asphalt
|
|
2300
|
+
paving_stones: 0.9,
|
|
2301
|
+
// Slightly slower but good for walking
|
|
2302
|
+
compacted: 0.8,
|
|
2303
|
+
// Still good for walking
|
|
2304
|
+
wood: 0.8,
|
|
2305
|
+
// Good when dry, slower when wet
|
|
2306
|
+
metal: 0.7,
|
|
2307
|
+
// Requires more attention
|
|
2308
|
+
gravel: 0.6,
|
|
2309
|
+
// Slower but manageable
|
|
2310
|
+
grass: 0.5,
|
|
2311
|
+
// Significantly slower
|
|
2312
|
+
ground: 0.4
|
|
2313
|
+
// Unpaved/natural - requires more effort
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2254
2316
|
const _GraphRouterOptionsBuilder = class _GraphRouterOptionsBuilder {
|
|
2255
2317
|
constructor() {
|
|
2256
2318
|
__publicField(this, "avoidStairs", false);
|
|
@@ -2260,6 +2322,7 @@ const _GraphRouterOptionsBuilder = class _GraphRouterOptionsBuilder {
|
|
|
2260
2322
|
__publicField(this, "avoidTicketRestrictedAreas", false);
|
|
2261
2323
|
__publicField(this, "useMultiLevelSegments", false);
|
|
2262
2324
|
__publicField(this, "projectionMaxDistance");
|
|
2325
|
+
__publicField(this, "isWheelchair", false);
|
|
2263
2326
|
}
|
|
2264
2327
|
setAvoidStairs(avoidStairs) {
|
|
2265
2328
|
this.avoidStairs = avoidStairs;
|
|
@@ -2285,6 +2348,10 @@ const _GraphRouterOptionsBuilder = class _GraphRouterOptionsBuilder {
|
|
|
2285
2348
|
this.useMultiLevelSegments = useMultiLevelSegments;
|
|
2286
2349
|
return this;
|
|
2287
2350
|
}
|
|
2351
|
+
setIsWheelchair(isWheelchair) {
|
|
2352
|
+
this.isWheelchair = isWheelchair;
|
|
2353
|
+
return this;
|
|
2354
|
+
}
|
|
2288
2355
|
static fromJson(options) {
|
|
2289
2356
|
const builder = new _GraphRouterOptionsBuilder();
|
|
2290
2357
|
Object.assign(builder, options);
|
|
@@ -2295,17 +2362,40 @@ const _GraphRouterOptionsBuilder = class _GraphRouterOptionsBuilder {
|
|
|
2295
2362
|
if (edge.properties.isElevator) {
|
|
2296
2363
|
return 90;
|
|
2297
2364
|
}
|
|
2298
|
-
|
|
2365
|
+
const speed = this.isWheelchair ? SPEEDS.WHEELCHAIR : SPEEDS.DEFAULT;
|
|
2366
|
+
let duration = getDurationFromLength(edge.length, speed);
|
|
2299
2367
|
if (edge.properties.areStairs) {
|
|
2300
2368
|
duration *= 3;
|
|
2301
2369
|
} else if (edge.properties.areEscalators) {
|
|
2302
2370
|
duration *= 1.5;
|
|
2303
2371
|
} else if (edge.properties.isMovingWalkway) {
|
|
2304
2372
|
duration *= 0.8;
|
|
2373
|
+
} else if (edge.properties.smoothness) {
|
|
2374
|
+
const profile = this.isWheelchair ? "wheelchair" : "default";
|
|
2375
|
+
const factor = SMOOTHNESS_FACTORS[profile][edge.properties.smoothness] ?? 1;
|
|
2376
|
+
duration *= factor;
|
|
2377
|
+
} else if (edge.properties.surface) {
|
|
2378
|
+
const profile = this.isWheelchair ? "wheelchair" : "default";
|
|
2379
|
+
const factor = SURFACE_FACTORS[profile][edge.properties.surface] ?? 1;
|
|
2380
|
+
duration *= factor;
|
|
2305
2381
|
}
|
|
2306
2382
|
return duration;
|
|
2307
2383
|
};
|
|
2308
2384
|
const acceptEdgeFn = (edge) => {
|
|
2385
|
+
if (edge.properties.wheelchair) {
|
|
2386
|
+
if (this.isWheelchair && edge.properties.wheelchair === "no")
|
|
2387
|
+
return false;
|
|
2388
|
+
if (!this.isWheelchair && edge.properties.wheelchair === "designated")
|
|
2389
|
+
return false;
|
|
2390
|
+
}
|
|
2391
|
+
if (this.isWheelchair) {
|
|
2392
|
+
if (edge.properties.areStairs)
|
|
2393
|
+
return false;
|
|
2394
|
+
if (edge.properties.areEscalators)
|
|
2395
|
+
return false;
|
|
2396
|
+
if (edge.properties.isMovingWalkway)
|
|
2397
|
+
return false;
|
|
2398
|
+
}
|
|
2309
2399
|
if (this.avoidStairs && edge.properties.areStairs)
|
|
2310
2400
|
return false;
|
|
2311
2401
|
if (this.avoidEscalators && edge.properties.areEscalators)
|
|
@@ -2325,6 +2415,7 @@ const _GraphRouterOptionsBuilder = class _GraphRouterOptionsBuilder {
|
|
|
2325
2415
|
avoidElevators: this.avoidElevators,
|
|
2326
2416
|
avoidMovingWalkways: this.avoidMovingWalkways,
|
|
2327
2417
|
avoidTicketRestrictedAreas: this.avoidTicketRestrictedAreas,
|
|
2418
|
+
isWheelchair: this.isWheelchair,
|
|
2328
2419
|
projectionMaxDistance: this.projectionMaxDistance
|
|
2329
2420
|
},
|
|
2330
2421
|
weightEdgeFn,
|
|
@@ -2336,6 +2427,7 @@ const _GraphRouterOptionsBuilder = class _GraphRouterOptionsBuilder {
|
|
|
2336
2427
|
};
|
|
2337
2428
|
__publicField(_GraphRouterOptionsBuilder, "DEFAULT", new _GraphRouterOptionsBuilder().build());
|
|
2338
2429
|
__publicField(_GraphRouterOptionsBuilder, "WITHOUT_STAIRS", new _GraphRouterOptionsBuilder().setAvoidStairs(true).build());
|
|
2430
|
+
__publicField(_GraphRouterOptionsBuilder, "WHEELCHAIR", new _GraphRouterOptionsBuilder().setIsWheelchair(true).build());
|
|
2339
2431
|
let GraphRouterOptionsBuilder = _GraphRouterOptionsBuilder;
|
|
2340
2432
|
class GraphRouterEngineResults {
|
|
2341
2433
|
constructor(prev, dist, source, targets, edges) {
|
|
@@ -2760,7 +2852,10 @@ const _OsmGraphUtils = class _OsmGraphUtils {
|
|
|
2760
2852
|
...osmWay.areEscalators && { areEscalators: osmWay.areEscalators },
|
|
2761
2853
|
...osmWay.isMovingWalkway && { isMovingWalkway: osmWay.isMovingWalkway },
|
|
2762
2854
|
...osmWay.needTicket && { needTicket: osmWay.needTicket },
|
|
2763
|
-
...osmWay.incline && { incline: osmWay.incline }
|
|
2855
|
+
...osmWay.incline && { incline: osmWay.incline },
|
|
2856
|
+
...osmWay.wheelchair && { wheelchair: osmWay.wheelchair },
|
|
2857
|
+
...osmWay.smoothness && { smoothness: osmWay.smoothness },
|
|
2858
|
+
...osmWay.surface && { surface: osmWay.surface }
|
|
2764
2859
|
};
|
|
2765
2860
|
}
|
|
2766
2861
|
static createGraphFromOsmModel(osmModel, waySelectionFilter = _OsmGraphUtils.DEFAULT_WAY_SELECTOR, callbackVerticesMapping) {
|
|
@@ -3280,7 +3375,7 @@ class NavitiaRemoteRouter extends RemoteRouter {
|
|
|
3280
3375
|
coreParams.set("from", `${origin.longitude};${origin.latitude}`);
|
|
3281
3376
|
coreParams.set("to", `${destination.longitude};${destination.latitude}`);
|
|
3282
3377
|
coreParams.set("data_freshness", "realtime");
|
|
3283
|
-
if ((_a = routerRequest.itineraryModifiers) == null ? void 0 : _a.
|
|
3378
|
+
if ((_a = routerRequest.itineraryModifiers) == null ? void 0 : _a.isWheelchair) {
|
|
3284
3379
|
coreParams.set("wheelchair", "true");
|
|
3285
3380
|
}
|
|
3286
3381
|
let queryParams = new URLSearchParams();
|
|
@@ -3811,7 +3906,7 @@ class IdfmRemoteRouter extends RemoteRouter {
|
|
|
3811
3906
|
coreParams.set("from", `${origin.longitude};${origin.latitude}`);
|
|
3812
3907
|
coreParams.set("to", `${destination.longitude};${destination.latitude}`);
|
|
3813
3908
|
coreParams.set("data_freshness", "realtime");
|
|
3814
|
-
if ((_a = routerRequest.itineraryModifiers) == null ? void 0 : _a.
|
|
3909
|
+
if ((_a = routerRequest.itineraryModifiers) == null ? void 0 : _a.isWheelchair) {
|
|
3815
3910
|
coreParams.set("wheelchair", "true");
|
|
3816
3911
|
}
|
|
3817
3912
|
let queryParams = new URLSearchParams();
|
|
@@ -4042,7 +4137,7 @@ class OsrmRemoteRouter extends RemoteRouter {
|
|
|
4042
4137
|
__publicField(this, "inputModeCorrespondance", (routerRequest) => {
|
|
4043
4138
|
var _a;
|
|
4044
4139
|
const { travelMode, travelModePreference: preference } = routerRequest;
|
|
4045
|
-
if (travelMode === "WALK" && ((_a = routerRequest.itineraryModifiers) == null ? void 0 : _a.
|
|
4140
|
+
if (travelMode === "WALK" && ((_a = routerRequest.itineraryModifiers) == null ? void 0 : _a.isWheelchair))
|
|
4046
4141
|
return "pmr";
|
|
4047
4142
|
if (travelMode === "WALK")
|
|
4048
4143
|
return "walking";
|