@wemap/osm 5.1.10 → 5.1.11
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": "5.1.
|
|
14
|
+
"version": "5.1.11",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/wemap/wemap-modules-js/issues"
|
|
17
17
|
},
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"@wemap/maths": "^5.1.1",
|
|
32
32
|
"saxes": "^5.0.1"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "ad1b007731fcd555d3802874c240aa4b567545c7"
|
|
35
35
|
}
|
|
@@ -164,7 +164,11 @@ function parseJsonSteps(jsonSteps, legCoords) {
|
|
|
164
164
|
const step = new Step();
|
|
165
165
|
step.coords = jsonToCoordinates(jsonStep.maneuver.location);
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
// Sometimes, OSRM step does not have the same coordinates than a point in legCoords.
|
|
168
|
+
// ex: first step of https://routing.getwemap.com/route/v1/walking/2.33222164147,48.87084765712;2.3320734,48.8730212?geometries=geojson&overview=full&steps=true
|
|
169
|
+
// That is why we look for the closest point.
|
|
170
|
+
const distances = legCoords.map(coords => coords.distanceTo(step.coords));
|
|
171
|
+
const idStepCoordsInLeg = distances.indexOf(Math.min(...distances));
|
|
168
172
|
if (idStepCoordsInLeg < 0) {
|
|
169
173
|
throw new Error('Osrm Parser: Cannot find step coords in leg coordinates');
|
|
170
174
|
}
|