@wemap/routers 11.2.2 → 11.2.4

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.
@@ -0,0 +1,457 @@
1
+ {
2
+ "code": "Ok",
3
+ "routes": [
4
+ {
5
+ "geometry": {
6
+ "coordinates": [
7
+ [
8
+ 2.353748,
9
+ 48.880501
10
+ ],
11
+ [
12
+ 2.353767,
13
+ 48.880463
14
+ ],
15
+ [
16
+ 2.353773,
17
+ 48.880449
18
+ ],
19
+ [
20
+ 2.353771,
21
+ 48.88043
22
+ ],
23
+ [
24
+ 2.353717,
25
+ 48.880311
26
+ ],
27
+ [
28
+ 2.353738,
29
+ 48.880307
30
+ ],
31
+ [
32
+ 2.353869,
33
+ 48.880278
34
+ ],
35
+ [
36
+ 2.354497,
37
+ 48.880096
38
+ ],
39
+ [
40
+ 2.354557,
41
+ 48.880082
42
+ ],
43
+ [
44
+ 2.354768,
45
+ 48.880026
46
+ ],
47
+ [
48
+ 2.354753,
49
+ 48.879998
50
+ ],
51
+ [
52
+ 2.354763,
53
+ 48.879961
54
+ ],
55
+ [
56
+ 2.354741,
57
+ 48.879921
58
+ ]
59
+ ],
60
+ "type": "LineString"
61
+ },
62
+ "legs": [
63
+ {
64
+ "steps": [
65
+ {
66
+ "geometry": {
67
+ "coordinates": [
68
+ [
69
+ 2.353748,
70
+ 48.880501
71
+ ],
72
+ [
73
+ 2.353767,
74
+ 48.880463
75
+ ],
76
+ [
77
+ 2.353773,
78
+ 48.880449
79
+ ],
80
+ [
81
+ 2.353771,
82
+ 48.88043
83
+ ],
84
+ [
85
+ 2.353717,
86
+ 48.880311
87
+ ]
88
+ ],
89
+ "type": "LineString"
90
+ },
91
+ "maneuver": {
92
+ "bearing_after": 162,
93
+ "bearing_before": 0,
94
+ "location": [
95
+ 2.353747,
96
+ 48.880506
97
+ ],
98
+ "type": "depart"
99
+ },
100
+ "mode": "walking",
101
+ "driving_side": "right",
102
+ "name": "Rue de Compiègne",
103
+ "intersections": [
104
+ {
105
+ "out": 0,
106
+ "entry": [
107
+ true
108
+ ],
109
+ "bearings": [
110
+ 162
111
+ ],
112
+ "location": [
113
+ 2.353747,
114
+ 48.880506
115
+ ]
116
+ }
117
+ ],
118
+ "weight": 16.1,
119
+ "duration": 16.1,
120
+ "distance": 22.6
121
+ },
122
+ {
123
+ "geometry": {
124
+ "coordinates": [
125
+ [
126
+ 2.353717,
127
+ 48.880311
128
+ ],
129
+ [
130
+ 2.353738,
131
+ 48.880307
132
+ ],
133
+ [
134
+ 2.353869,
135
+ 48.880278
136
+ ],
137
+ [
138
+ 2.354497,
139
+ 48.880096
140
+ ],
141
+ [
142
+ 2.354557,
143
+ 48.880082
144
+ ],
145
+ [
146
+ 2.354768,
147
+ 48.880026
148
+ ]
149
+ ],
150
+ "type": "LineString"
151
+ },
152
+ "maneuver": {
153
+ "bearing_after": 105,
154
+ "bearing_before": 195,
155
+ "location": [
156
+ 2.353717,
157
+ 48.880311
158
+ ],
159
+ "modifier": "left",
160
+ "type": "turn"
161
+ },
162
+ "mode": "walking",
163
+ "driving_side": "right",
164
+ "name": "",
165
+ "intersections": [
166
+ {
167
+ "out": 1,
168
+ "in": 0,
169
+ "entry": [
170
+ false,
171
+ true,
172
+ true,
173
+ true
174
+ ],
175
+ "bearings": [
176
+ 15,
177
+ 105,
178
+ 225,
179
+ 285
180
+ ],
181
+ "location": [
182
+ 2.353717,
183
+ 48.880311
184
+ ]
185
+ },
186
+ {
187
+ "out": 1,
188
+ "in": 3,
189
+ "entry": [
190
+ true,
191
+ true,
192
+ true,
193
+ false
194
+ ],
195
+ "bearings": [
196
+ 15,
197
+ 105,
198
+ 135,
199
+ 285
200
+ ],
201
+ "location": [
202
+ 2.353738,
203
+ 48.880307
204
+ ]
205
+ },
206
+ {
207
+ "out": 0,
208
+ "in": 2,
209
+ "entry": [
210
+ true,
211
+ true,
212
+ false
213
+ ],
214
+ "bearings": [
215
+ 120,
216
+ 195,
217
+ 285
218
+ ],
219
+ "location": [
220
+ 2.353869,
221
+ 48.880278
222
+ ]
223
+ },
224
+ {
225
+ "out": 1,
226
+ "in": 3,
227
+ "entry": [
228
+ true,
229
+ true,
230
+ true,
231
+ false
232
+ ],
233
+ "bearings": [
234
+ 75,
235
+ 105,
236
+ 195,
237
+ 285
238
+ ],
239
+ "location": [
240
+ 2.354557,
241
+ 48.880082
242
+ ]
243
+ }
244
+ ],
245
+ "weight": 60.1,
246
+ "duration": 60.1,
247
+ "distance": 83.4
248
+ },
249
+ {
250
+ "geometry": {
251
+ "coordinates": [
252
+ [
253
+ 2.354768,
254
+ 48.880026
255
+ ],
256
+ [
257
+ 2.354753,
258
+ 48.879998
259
+ ],
260
+ [
261
+ 2.354763,
262
+ 48.879961
263
+ ]
264
+ ],
265
+ "type": "LineString"
266
+ },
267
+ "maneuver": {
268
+ "bearing_after": 198,
269
+ "bearing_before": 111,
270
+ "location": [
271
+ 2.354768,
272
+ 48.880026
273
+ ],
274
+ "modifier": "right",
275
+ "type": "turn"
276
+ },
277
+ "mode": "walking",
278
+ "driving_side": "right",
279
+ "name": "",
280
+ "intersections": [
281
+ {
282
+ "out": 2,
283
+ "in": 3,
284
+ "entry": [
285
+ true,
286
+ true,
287
+ true,
288
+ false
289
+ ],
290
+ "bearings": [
291
+ 30,
292
+ 105,
293
+ 195,
294
+ 285
295
+ ],
296
+ "location": [
297
+ 2.354768,
298
+ 48.880026
299
+ ]
300
+ },
301
+ {
302
+ "out": 2,
303
+ "in": 0,
304
+ "entry": [
305
+ false,
306
+ true,
307
+ true,
308
+ true
309
+ ],
310
+ "bearings": [
311
+ 15,
312
+ 105,
313
+ 165,
314
+ 285
315
+ ],
316
+ "location": [
317
+ 2.354753,
318
+ 48.879998
319
+ ]
320
+ }
321
+ ],
322
+ "weight": 5.4,
323
+ "duration": 5.4,
324
+ "distance": 7.5
325
+ },
326
+ {
327
+ "geometry": {
328
+ "coordinates": [
329
+ [
330
+ 2.354763,
331
+ 48.879961
332
+ ],
333
+ [
334
+ 2.354741,
335
+ 48.879921
336
+ ]
337
+ ],
338
+ "type": "LineString"
339
+ },
340
+ "maneuver": {
341
+ "bearing_after": 205,
342
+ "bearing_before": 168,
343
+ "location": [
344
+ 2.354763,
345
+ 48.879961
346
+ ],
347
+ "modifier": "slight right",
348
+ "type": "turn"
349
+ },
350
+ "mode": "walking",
351
+ "driving_side": "right",
352
+ "name": "Boulevard de Denain",
353
+ "intersections": [
354
+ {
355
+ "out": 1,
356
+ "in": 3,
357
+ "entry": [
358
+ true,
359
+ true,
360
+ true,
361
+ false
362
+ ],
363
+ "bearings": [
364
+ 105,
365
+ 210,
366
+ 285,
367
+ 345
368
+ ],
369
+ "location": [
370
+ 2.354763,
371
+ 48.879961
372
+ ]
373
+ }
374
+ ],
375
+ "weight": 3.4,
376
+ "duration": 3.4,
377
+ "distance": 4.7
378
+ },
379
+ {
380
+ "geometry": {
381
+ "coordinates": [
382
+ [
383
+ 2.354741,
384
+ 48.879921
385
+ ],
386
+ [
387
+ 2.354741,
388
+ 48.879921
389
+ ]
390
+ ],
391
+ "type": "LineString"
392
+ },
393
+ "maneuver": {
394
+ "bearing_after": 0,
395
+ "bearing_before": 200,
396
+ "location": [
397
+ 2.354741,
398
+ 48.879921
399
+ ],
400
+ "type": "arrive"
401
+ },
402
+ "mode": "walking",
403
+ "driving_side": "right",
404
+ "name": "Boulevard de Denain",
405
+ "intersections": [
406
+ {
407
+ "in": 0,
408
+ "entry": [
409
+ true
410
+ ],
411
+ "bearings": [
412
+ 20
413
+ ],
414
+ "location": [
415
+ 2.354741,
416
+ 48.879921
417
+ ]
418
+ }
419
+ ],
420
+ "weight": 0,
421
+ "duration": 0,
422
+ "distance": 0
423
+ }
424
+ ],
425
+ "summary": "Rue de Compiègne, Boulevard de Denain",
426
+ "weight": 85,
427
+ "duration": 85,
428
+ "distance": 118.2
429
+ }
430
+ ],
431
+ "weight_name": "duration",
432
+ "weight": 85,
433
+ "duration": 85,
434
+ "distance": 118.2
435
+ }
436
+ ],
437
+ "waypoints": [
438
+ {
439
+ "hint": "rrs9gFFQFIIDAAAACQAAAJ4AAAB2AwAAJpQPPwwbkT8B_69BG9z2QgMAAAAJAAAAngAAAHYDAAACAAAAU-ojAHrb6QJU6iMAetvpAgQA7xU6JEHh",
440
+ "distance": 0.073354726,
441
+ "name": "Rue de Compiègne",
442
+ "location": [
443
+ 2.353747,
444
+ 48.880506
445
+ ]
446
+ },
447
+ {
448
+ "hint": "404UgudOFIIKAAAAIgAAAC0AAAAAAAAA6gW3P2lsl0DnEMhAAAAAAAoAAAAiAAAALQAAAAAAAAACAAAANe4jADHZ6QIw7iMAMtnpAgEATwE6JEHh",
449
+ "distance": 0.383262267,
450
+ "name": "Boulevard de Denain",
451
+ "location": [
452
+ 2.354741,
453
+ 48.879921
454
+ ]
455
+ }
456
+ ]
457
+ }
package/dist/index.js CHANGED
@@ -1600,7 +1600,7 @@ class OsrmRemoteRouter extends RemoteRouter {
1600
1600
  throw new Error("Osrm Parser: Cannot find step coords in leg coordinates");
1601
1601
  }
1602
1602
  return {
1603
- coords: stepCoords,
1603
+ coords: legCoords[idStepCoordsInLeg],
1604
1604
  name,
1605
1605
  distance,
1606
1606
  duration
@@ -2114,9 +2114,16 @@ class CustomNetworkMap {
2114
2114
  }
2115
2115
  getOrderedEntryPointsSortedByDistance(start, end) {
2116
2116
  const entryPointsCopy = [...this.entryPoints];
2117
- return entryPointsCopy.sort(
2118
- (ep1, ep2) => Number(ep1.coords.distanceTo(start)) + ep1.coords.distanceTo(end) - ep2.coords.distanceTo(start) - ep2.coords.distanceTo(end)
2119
- );
2117
+ const levelDiffFactor = 50;
2118
+ return entryPointsCopy.sort((ep1, ep2) => {
2119
+ const distance2D = Number(ep1.coords.distanceTo(start)) + ep1.coords.distanceTo(end) - (ep2.coords.distanceTo(start) + ep2.coords.distanceTo(end));
2120
+ const levelDiffEp1Start = Math.abs(geo.Level.diff(start.level, ep1.coords.level) || 0);
2121
+ const levelDiffEp1End = Math.abs(geo.Level.diff(end.level, ep1.coords.level) || 0);
2122
+ const levelDiffEp2Start = Math.abs(geo.Level.diff(start.level, ep2.coords.level) || 0);
2123
+ const levelDiffEp2End = Math.abs(geo.Level.diff(end.level, ep2.coords.level) || 0);
2124
+ const levelDiff = levelDiffEp1Start + levelDiffEp1End - (levelDiffEp2Start + levelDiffEp2End);
2125
+ return distance2D + levelDiff * levelDiffFactor;
2126
+ });
2120
2127
  }
2121
2128
  getBestItineraryFromEntryPointsToEnd(start, end, options) {
2122
2129
  const sortedEntryPoints = this.getOrderedEntryPointsSortedByDistance(start, end);