@wemap/routers 12.4.0 → 12.6.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/assets/stairs-and-exit.osm +47 -0
- package/dist/index.js +25 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -21
- package/dist/index.mjs.map +1 -1
- package/index.ts +2 -2
- package/package.json +3 -3
- package/src/graph/GraphRouter.spec.ts +8 -1
- package/src/graph/GraphRouter.ts +1 -1
- package/src/graph/GraphRouterOptionsBuilder.ts +4 -0
- package/src/wemap-multi/{CustomNetworkMap.spec.ts → CustomGraphMap.spec.ts} +8 -8
- package/src/wemap-multi/{CustomNetworkMap.ts → CustomGraphMap.ts} +2 -4
- package/src/wemap-multi/{CustomNetworkMapTester.spec.ts → CustomGraphMapTester.spec.ts} +3 -3
- package/src/wemap-multi/{CustomNetworkMapTester.ts → CustomGraphMapTester.ts} +13 -14
- package/src/wemap-multi/WemapMultiRouter.spec.ts +3 -3
- package/src/wemap-multi/WemapMultiRouter.ts +6 -6
- package/src/wemap-osm/OsmGraphUtils.spec.ts +26 -11
- package/src/wemap-osm/OsmGraphUtils.ts +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
|
2
|
+
<osm version='0.6' generator='JOSM'>
|
|
3
|
+
<node id='-1610618489058234' action='modify' visible='true' lat='48.87601173273' lon='2.32555037119'>
|
|
4
|
+
<tag k='name' v='p1' />
|
|
5
|
+
</node>
|
|
6
|
+
<node id='-1610618489058235' action='modify' visible='true' lat='48.87597991746' lon='2.3253223214'>
|
|
7
|
+
<tag k='name' v='p2' />
|
|
8
|
+
</node>
|
|
9
|
+
<node id='-1610618489058236' action='modify' visible='true' lat='48.87573599972' lon='2.32538912386'>
|
|
10
|
+
<tag k='name' v='p3' />
|
|
11
|
+
</node>
|
|
12
|
+
<node id='-1610618489058237' action='modify' visible='true' lat='48.87575872503' lon='2.32561026305'>
|
|
13
|
+
<tag k='name' v='p4' />
|
|
14
|
+
</node>
|
|
15
|
+
<node id='-1610618489058238' action='modify' visible='true' lat='48.87619959391' lon='2.32495145256' />
|
|
16
|
+
<node id='-1610618489058239' action='modify' visible='true' lat='48.87625261911' lon='2.32559874539' />
|
|
17
|
+
<node id='-1610618489058240' action='modify' visible='true' lat='48.87542996461' lon='2.32583140224' />
|
|
18
|
+
<node id='-1610618489058241' action='modify' visible='true' lat='48.87539057382' lon='2.32522557301' />
|
|
19
|
+
<way id='-921430905799056' action='modify' visible='true'>
|
|
20
|
+
<nd ref='-1610618489058234' />
|
|
21
|
+
<nd ref='-1610618489058235' />
|
|
22
|
+
<tag k='highway' v='steps' />
|
|
23
|
+
<tag k='level' v='0;1' />
|
|
24
|
+
<tag k='name' v='e1' />
|
|
25
|
+
</way>
|
|
26
|
+
<way id='-921430905799057' action='modify' visible='true'>
|
|
27
|
+
<nd ref='-1610618489058236' />
|
|
28
|
+
<nd ref='-1610618489058237' />
|
|
29
|
+
<tag k='highway' v='footway' />
|
|
30
|
+
<tag k='name' v='e3' />
|
|
31
|
+
</way>
|
|
32
|
+
<way id='-921430905799058' action='modify' visible='true'>
|
|
33
|
+
<nd ref='-1610618489058238' />
|
|
34
|
+
<nd ref='-1610618489058239' />
|
|
35
|
+
<nd ref='-1610618489058240' />
|
|
36
|
+
<nd ref='-1610618489058241' />
|
|
37
|
+
<nd ref='-1610618489058238' />
|
|
38
|
+
<tag k='wemap:routing-bounds' v='yes' />
|
|
39
|
+
</way>
|
|
40
|
+
<way id='-921430905799059' action='modify' visible='true'>
|
|
41
|
+
<nd ref='-1610618489058235' />
|
|
42
|
+
<nd ref='-1610618489058236' />
|
|
43
|
+
<tag k='highway' v='footway' />
|
|
44
|
+
<tag k='level' v='0' />
|
|
45
|
+
<tag k='name' v='e2' />
|
|
46
|
+
</way>
|
|
47
|
+
</osm>
|
package/dist/index.js
CHANGED
|
@@ -2271,6 +2271,10 @@ const _GraphRouterOptionsBuilder = class _GraphRouterOptionsBuilder {
|
|
|
2271
2271
|
let duration = getDurationFromLength(edge.length, 4);
|
|
2272
2272
|
if (edge.properties.areStairs) {
|
|
2273
2273
|
duration *= 3;
|
|
2274
|
+
} else if (edge.properties.areEscalators) {
|
|
2275
|
+
duration *= 1.5;
|
|
2276
|
+
} else if (edge.properties.isMovingWalkway) {
|
|
2277
|
+
duration *= 0.8;
|
|
2274
2278
|
}
|
|
2275
2279
|
return duration;
|
|
2276
2280
|
};
|
|
@@ -2621,7 +2625,7 @@ class GraphRouter extends GraphRouterEngine {
|
|
|
2621
2625
|
const distVertexAVertex1 = vertexA.distanceTo(edge.vertex1);
|
|
2622
2626
|
for (let j = i + 1; j < vertices.length; j++) {
|
|
2623
2627
|
const vertexB = vertices[j];
|
|
2624
|
-
const distVertexBVertex1 =
|
|
2628
|
+
const distVertexBVertex1 = vertexB.distanceTo(edge.vertex1);
|
|
2625
2629
|
const reverse = distVertexBVertex1 < distVertexAVertex1;
|
|
2626
2630
|
const newEdge = !reverse ? new Edge(vertexA, vertexB, newEdgesOptions) : new Edge(vertexB, vertexA, newEdgesOptions);
|
|
2627
2631
|
createdEdges.add(newEdge);
|
|
@@ -2746,7 +2750,7 @@ const _OsmGraphUtils = class _OsmGraphUtils {
|
|
|
2746
2750
|
})) == null ? void 0 : _a[1]) || null;
|
|
2747
2751
|
if (vertex) {
|
|
2748
2752
|
if (!geo.Level.equals(vertex.coords.level, nodeLevel)) {
|
|
2749
|
-
vertex.coords.level = geo.Level.intersection(vertex.coords.level, nodeLevel);
|
|
2753
|
+
vertex.coords.level = geo.Level.intersection(vertex.coords.level, nodeLevel) || nodeLevel;
|
|
2750
2754
|
}
|
|
2751
2755
|
return vertex;
|
|
2752
2756
|
}
|
|
@@ -3871,11 +3875,11 @@ class WemapMultiRouter {
|
|
|
3871
3875
|
get rname() {
|
|
3872
3876
|
return "wemap-multi";
|
|
3873
3877
|
}
|
|
3874
|
-
addIOMap(
|
|
3875
|
-
this.maps.push(
|
|
3878
|
+
addIOMap(customGraphMap) {
|
|
3879
|
+
this.maps.push(customGraphMap);
|
|
3876
3880
|
}
|
|
3877
|
-
removeIOMap(
|
|
3878
|
-
this.maps = this.maps.filter((map) => map !==
|
|
3881
|
+
removeIOMap(customGraphMap) {
|
|
3882
|
+
this.maps = this.maps.filter((map) => map !== customGraphMap);
|
|
3879
3883
|
}
|
|
3880
3884
|
removeAllMaps() {
|
|
3881
3885
|
this.maps = [];
|
|
@@ -4025,7 +4029,7 @@ class WemapMultiRouter {
|
|
|
4025
4029
|
throw new Error("Should never happen");
|
|
4026
4030
|
}
|
|
4027
4031
|
}
|
|
4028
|
-
class
|
|
4032
|
+
class CustomGraphMap {
|
|
4029
4033
|
constructor(graph, entryPoints, bounds = null, name = null) {
|
|
4030
4034
|
__publicField(this, "name");
|
|
4031
4035
|
__publicField(this, "graph");
|
|
@@ -4102,7 +4106,7 @@ class CustomNetworkMap {
|
|
|
4102
4106
|
errors.routingBoundsNotFound = true;
|
|
4103
4107
|
}
|
|
4104
4108
|
callbackErrors == null ? void 0 : callbackErrors(errors);
|
|
4105
|
-
return new
|
|
4109
|
+
return new CustomGraphMap(graph, entryPoints, bounds, name);
|
|
4106
4110
|
}
|
|
4107
4111
|
isPointInside(coordinates) {
|
|
4108
4112
|
return pointInPolygon([coordinates.lng, coordinates.lat], this.bounds);
|
|
@@ -4178,42 +4182,42 @@ class CustomNetworkMap {
|
|
|
4178
4182
|
return this.router.calculateShortestPathToMultipleDestinations(start, ends, options);
|
|
4179
4183
|
}
|
|
4180
4184
|
}
|
|
4181
|
-
class
|
|
4185
|
+
class CustomGraphMapTester {
|
|
4182
4186
|
static createReport(osmXmlString) {
|
|
4183
4187
|
var _a;
|
|
4184
|
-
let
|
|
4185
|
-
const
|
|
4188
|
+
let customGraphMapErrors;
|
|
4189
|
+
const customGraphMap = CustomGraphMap.fromOsmXml(osmXmlString, null, (e) => customGraphMapErrors = e);
|
|
4186
4190
|
const errors = [];
|
|
4187
|
-
if ((
|
|
4191
|
+
if ((customGraphMapErrors == null ? void 0 : customGraphMapErrors.couldNotParseFile) || !customGraphMap) {
|
|
4188
4192
|
errors.push({
|
|
4189
4193
|
type: "could-not-parse-file"
|
|
4190
4194
|
});
|
|
4191
4195
|
return { errors };
|
|
4192
4196
|
}
|
|
4193
|
-
const components =
|
|
4197
|
+
const components = customGraphMap.router.calculateComponents();
|
|
4194
4198
|
if (components.length > 1) {
|
|
4195
4199
|
errors.push({
|
|
4196
4200
|
type: "multiple-graph-components",
|
|
4197
4201
|
data: components
|
|
4198
4202
|
});
|
|
4199
4203
|
}
|
|
4200
|
-
if (
|
|
4204
|
+
if (customGraphMapErrors == null ? void 0 : customGraphMapErrors.routingBoundsNotFound) {
|
|
4201
4205
|
errors.push({
|
|
4202
4206
|
type: "routing-bounds-not-found"
|
|
4203
4207
|
});
|
|
4204
4208
|
}
|
|
4205
|
-
if ((_a =
|
|
4209
|
+
if ((_a = customGraphMapErrors == null ? void 0 : customGraphMapErrors.routingIoNotFound) == null ? void 0 : _a.length) {
|
|
4206
4210
|
errors.push({
|
|
4207
4211
|
type: "routing-io-not-on-graph",
|
|
4208
|
-
data:
|
|
4212
|
+
data: customGraphMapErrors.routingIoNotFound
|
|
4209
4213
|
});
|
|
4210
4214
|
}
|
|
4211
|
-
return {
|
|
4215
|
+
return { customGraphMap, errors };
|
|
4212
4216
|
}
|
|
4213
4217
|
static reportToJson(report) {
|
|
4214
|
-
var _a;
|
|
4218
|
+
var _a, _b;
|
|
4215
4219
|
return {
|
|
4216
|
-
graph: (_a = report.
|
|
4220
|
+
graph: (_b = (_a = report.customGraphMap) == null ? void 0 : _a.graph) == null ? void 0 : _b.toCompressedJson(),
|
|
4217
4221
|
errors: report.errors.map((error) => {
|
|
4218
4222
|
if (error.type === "multiple-graph-components") {
|
|
4219
4223
|
return { type: error.type, data: error.data.map((c) => c.map((v) => v.id)) };
|
|
@@ -4326,8 +4330,8 @@ class ItineraryInfoManager {
|
|
|
4326
4330
|
}
|
|
4327
4331
|
}
|
|
4328
4332
|
exports.CitywayRemoteRouter = CitywayRemoteRouter$1;
|
|
4329
|
-
exports.
|
|
4330
|
-
exports.
|
|
4333
|
+
exports.CustomGraphMap = CustomGraphMap;
|
|
4334
|
+
exports.CustomGraphMapTester = CustomGraphMapTester;
|
|
4331
4335
|
exports.DeutscheBahnRemoteRouter = DeutscheBahnRemoteRouter$1;
|
|
4332
4336
|
exports.Edge = Edge;
|
|
4333
4337
|
exports.Graph = Graph;
|