@wemap/osm 4.0.3 → 4.0.10
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/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/osm"
|
|
12
12
|
},
|
|
13
13
|
"name": "@wemap/osm",
|
|
14
|
-
"version": "4.0.
|
|
14
|
+
"version": "4.0.10",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/wemap/wemap-modules-js/issues"
|
|
17
17
|
},
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
],
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@wemap/geo": "^4.0.
|
|
28
|
+
"@wemap/geo": "^4.0.10",
|
|
29
29
|
"@wemap/logger": "^4.0.0",
|
|
30
30
|
"@wemap/maths": "^4.0.3",
|
|
31
31
|
"sax": "^1.2.4"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "684e1328f164054572b32f241e3e3b85cc3b1362"
|
|
34
34
|
}
|
|
@@ -70,11 +70,12 @@ class OsmNetworkUtils {
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* @param {
|
|
73
|
+
* @param {Node} node
|
|
74
74
|
* @param {object} tags
|
|
75
75
|
*/
|
|
76
76
|
static _applyNodePropertiesFromTags(node, tags) {
|
|
77
77
|
node.name = tags.name || null;
|
|
78
|
+
node.subwayEntrance = tags.railway === 'subway_entrance';
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
/**
|
package/src/osrm/OsrmUtils.js
CHANGED
|
@@ -102,24 +102,15 @@ export function itineraryToOsrmJson(itinerary) {
|
|
|
102
102
|
bearing_after: rad2deg(bearingAfter),
|
|
103
103
|
location: coordinatesToJson(node.coords),
|
|
104
104
|
type
|
|
105
|
-
}
|
|
106
|
-
wemap: {}
|
|
105
|
+
}
|
|
107
106
|
};
|
|
108
107
|
|
|
109
108
|
if (levelChange !== null) {
|
|
110
109
|
osrmStep.levelChange = levelChange;
|
|
111
110
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
osrmStep.wemap.nodeProperties = nodeProperties;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (i !== lastStepId && nextEdge) {
|
|
119
|
-
const nextEdgeProperties = nextEdge.extractProperties();
|
|
120
|
-
if (Object.keys(nextEdgeProperties).length !== 0) {
|
|
121
|
-
osrmStep.wemap.nextEdgeProperties = nextEdgeProperties;
|
|
122
|
-
}
|
|
111
|
+
if (node.subwayEntrance) {
|
|
112
|
+
osrmStep.name = node.name;
|
|
113
|
+
osrmStep.subwayEntrance = true;
|
|
123
114
|
}
|
|
124
115
|
|
|
125
116
|
// The first modifier is not mandatory by OSRM.
|
|
@@ -220,21 +211,6 @@ function _parseSteps(itinerary, jsonSteps) {
|
|
|
220
211
|
step.name = jsonStep.name;
|
|
221
212
|
step.levelChange = jsonStep.levelChange ? jsonStep.levelChange : null;
|
|
222
213
|
|
|
223
|
-
/**
|
|
224
|
-
* Wemap fields
|
|
225
|
-
*/
|
|
226
|
-
if (jsonStep.wemap) {
|
|
227
|
-
const firstNode = step.nodes[0];
|
|
228
|
-
if (jsonStep.wemap.nodeProperties && firstNode) {
|
|
229
|
-
firstNode.applyProperties(jsonStep.wemap.nodeProperties);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const firstEdge = step.edges[0];
|
|
233
|
-
if (jsonStep.wemap.nextEdgeProperties && firstEdge) {
|
|
234
|
-
firstEdge.applyProperties(jsonStep.wemap.nextEdgeProperties);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
214
|
itinerary._steps.push(step);
|
|
239
215
|
|
|
240
216
|
currentNodeIndex--;
|
|
@@ -117,7 +117,8 @@ describe('OsrmUtils - itineraryToOsrmJson', () => {
|
|
|
117
117
|
expect(steps[4].maneuver.bearing_after).be.closeTo(12.22, 0.01);
|
|
118
118
|
expect(steps[4].levelChange).is.not.null;
|
|
119
119
|
expect(steps[4].levelChange.direction).equals('down');
|
|
120
|
-
expect(steps[4].levelChange.
|
|
120
|
+
expect(steps[4].levelChange.difference).equals(-1);
|
|
121
|
+
expect(steps[4].levelChange.type).equals('stairs');
|
|
121
122
|
|
|
122
123
|
expect(steps[5].maneuver.modifier).equals('left');
|
|
123
124
|
expect(steps[5].distance).be.closeTo(4.23, 0.01);
|
|
@@ -358,17 +359,9 @@ describe('OsrmUtils - itineraryToOsrmJson - createItineraryFromJson - way/node',
|
|
|
358
359
|
const osrmJson = itineraryToOsrmJson(itinerary);
|
|
359
360
|
const jsonSteps = osrmJson.routes[0].legs[0].steps;
|
|
360
361
|
|
|
361
|
-
expect(jsonSteps[0].
|
|
362
|
-
expect(jsonSteps[
|
|
363
|
-
expect(jsonSteps[0].wemap.nodeProperties.name).equals('w2');
|
|
364
|
-
|
|
365
|
-
expect(jsonSteps[4].wemap.nextEdgeProperties.name).equals('p19');
|
|
366
|
-
expect(jsonSteps[4].wemap.nextEdgeProperties.level).equals('0;2');
|
|
367
|
-
expect(jsonSteps[4].wemap.nodeProperties.name).equals('p19');
|
|
368
|
-
|
|
362
|
+
expect(jsonSteps[0].name).equals('w2');
|
|
363
|
+
expect(jsonSteps[4].name).equals('p19');
|
|
369
364
|
expect(jsonSteps[6].name).equals('p21');
|
|
370
|
-
expect(jsonSteps[6].wemap.nextEdgeProperties).is.undefined;
|
|
371
|
-
expect(jsonSteps[6].wemap.nodeProperties.name).equals('p21');
|
|
372
365
|
|
|
373
366
|
const itineraryBis = createItineraryFromJson(osrmJson, start, end);
|
|
374
367
|
verifyCoherence(itineraryBis);
|