@wemap/osm 2.7.11 → 2.7.13

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": "2.7.11",
14
+ "version": "2.7.13",
15
15
  "bugs": {
16
16
  "url": "https://github.com/wemap/wemap-modules-js/issues"
17
17
  },
@@ -32,5 +32,5 @@
32
32
  "lodash.isnumber": "^3.0.3",
33
33
  "sax": "^1.2.4"
34
34
  },
35
- "gitHead": "933f7fe5b16feed45fb06f9501981b1119b2c7af"
35
+ "gitHead": "bbe3d0a45f1260fcc8c50a62cda4b849ca82ca05"
36
36
  }
@@ -9,6 +9,9 @@ import {
9
9
  rad2deg, Utils as MathUtils, diffAngle, deg2rad
10
10
  } from '@wemap/maths';
11
11
 
12
+ import OsmNode from '../model/OsmNode';
13
+ import OsmWay from '../model/OsmWay';
14
+
12
15
 
13
16
  class OsrmUtils {
14
17
 
@@ -56,11 +59,17 @@ class OsrmUtils {
56
59
  }
57
60
 
58
61
  if (node.data && node.data.tags) {
59
- osrmStep.wemap.nodeTags = node.data.tags;
62
+ osrmStep.wemap.node = {
63
+ id: node.data.id,
64
+ tags: node.data.tags
65
+ };
60
66
  }
61
67
 
62
68
  if (i !== lastStepId) {
63
- osrmStep.wemap.nextEdgeTags = nextEdgeData.tags;
69
+ osrmStep.wemap.nextWay = {
70
+ id: nextEdgeData.id,
71
+ tags: nextEdgeData.tags
72
+ };
64
73
  }
65
74
 
66
75
  // The first modifier is not mandatory by OSRM.
@@ -170,7 +179,7 @@ class OsrmUtils {
170
179
  const node = itinerary.getNodeByCoords(wgs84);
171
180
  if (!node) {
172
181
  throw new Error('Cannot parse these step coordinates, '
173
- + 'they are not found in main itinerary: ' + wgs84.toString());
182
+ + 'they are not found in main itinerary: ' + wgs84.toString());
174
183
  }
175
184
  step.nodes.push(node);
176
185
 
@@ -208,17 +217,20 @@ class OsrmUtils {
208
217
  */
209
218
  if (jsonStep.wemap) {
210
219
  const firstNode = step.nodes[0];
211
- if (jsonStep.wemap.nodeTags && firstNode) {
212
- firstNode.data = { tags: jsonStep.wemap.nodeTags };
220
+ if (jsonStep.wemap.node && firstNode) {
221
+ const {
222
+ id, tags
223
+ } = jsonStep.wemap.node;
224
+ firstNode.data = new OsmNode(id, step.nodes[0].coords, tags);
213
225
  }
214
226
 
215
227
  const firstEdge = step.edges[0];
216
- if (jsonStep.wemap.nextEdgeTags && firstEdge) {
217
- firstEdge.data = {
218
- tags: jsonStep.wemap.nextEdgeTags,
219
- name: jsonStep.name
220
- };
221
-
228
+ if (jsonStep.wemap.nextWay && firstEdge) {
229
+ const {
230
+ id, tags
231
+ } = jsonStep.wemap.nextWay;
232
+ firstEdge.data = new OsmWay(id, tags);
233
+ firstEdge.data.level = firstEdge.level;
222
234
  }
223
235
  }
224
236