@wemap/osm 0.2.8 → 0.2.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"code":"Ok","routes":[{"geometry":{"coordinates":[[3.
|
|
1
|
+
{"code":"Ok","routes":[{"geometry":{"coordinates":[[3.875607,43.600777],[3.875723,43.600109],[3.875766,43.600086],[3.876247,43.599974],[3.876341,43.599956],[3.876396,43.599881],[3.876234,43.599853],[3.875869,43.599787],[3.875829,43.599781],[3.875671,43.599759],[3.875643,43.599755],[3.875606,43.599749],[3.875578,43.599746],[3.875498,43.599734],[3.87536,43.599707],[3.875169,43.599674],[3.874655,43.599577],[3.874623,43.599063],[3.873865,43.59906]],"type":"LineString"},"legs":[{"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[173],"location":[3.875607,43.600777]}],"driving_side":"right","geometry":{"coordinates":[[3.875607,43.600777],[3.875723,43.600109],[3.875766,43.600086],[3.876247,43.599974],[3.876341,43.599956],[3.876396,43.599881]],"type":"LineString"},"mode":"walking","duration":98.7,"maneuver":{"bearing_after":173,"type":"depart","modifier":"left","bearing_before":0,"location":[3.875607,43.600777]},"weight":98.7,"distance":137.2,"name":""},{"intersections":[{"out":1,"location":[3.876396,43.599881],"bearings":[75,255,330],"entry":[true,true,false],"in":2},{"out":2,"location":[3.876234,43.599853],"bearings":[75,180,255],"entry":[false,true,true],"in":0},{"out":2,"location":[3.875829,43.599781],"bearings":[75,195,255],"entry":[false,true,true],"in":0},{"out":2,"location":[3.875643,43.599755],"bearings":[75,135,255],"entry":[false,true,true],"in":0},{"out":2,"location":[3.875498,43.599734],"bearings":[75,165,255,345],"entry":[false,true,true,true],"in":0},{"out":2,"location":[3.875169,43.599674],"bearings":[75,180,255],"entry":[false,true,true],"in":0}],"driving_side":"right","geometry":{"coordinates":[[3.876396,43.599881],[3.876234,43.599853],[3.875869,43.599787],[3.875829,43.599781],[3.875671,43.599759],[3.875643,43.599755],[3.875606,43.599749],[3.875578,43.599746],[3.875498,43.599734],[3.87536,43.599707],[3.875169,43.599674],[3.874655,43.599577]],"type":"LineString"},"mode":"walking","duration":103.9,"maneuver":{"bearing_after":255,"type":"turn","modifier":"right","bearing_before":149,"location":[3.876396,43.599881]},"weight":103.9,"distance":144.3,"name":"Boulevard Vieussens"},{"intersections":[{"out":1,"location":[3.874655,43.599577],"bearings":[75,180,255],"entry":[false,true,true],"in":0}],"driving_side":"right","geometry":{"coordinates":[[3.874655,43.599577],[3.874623,43.599063]],"type":"LineString"},"mode":"walking","duration":41.2,"maneuver":{"bearing_after":181,"type":"turn","modifier":"left","bearing_before":254,"location":[3.874655,43.599577]},"weight":41.2,"distance":57.2,"name":"Impasse Bizeray"},{"intersections":[{"out":2,"location":[3.874623,43.599063],"bearings":[0,90,270],"entry":[false,true,true],"in":0}],"driving_side":"right","geometry":{"coordinates":[[3.874623,43.599063],[3.873865,43.59906]],"type":"LineString"},"mode":"walking","duration":44,"maneuver":{"bearing_after":268,"type":"turn","modifier":"right","bearing_before":181,"location":[3.874623,43.599063]},"weight":44,"distance":61.1,"name":"Rue du Docteur Louis Perrier"},{"intersections":[{"in":0,"entry":[true],"bearings":[90],"location":[3.873865,43.59906]}],"driving_side":"right","geometry":{"coordinates":[[3.873865,43.59906],[3.873865,43.59906]],"type":"LineString"},"mode":"walking","duration":0,"maneuver":{"bearing_after":0,"type":"arrive","modifier":"left","bearing_before":270,"location":[3.873865,43.59906]},"weight":0,"distance":0,"name":"Rue du Docteur Louis Perrier"}],"distance":399.7,"duration":287.8,"summary":"Boulevard Vieussens, Boulevard Berthelot","weight":287.8}],"distance":399.7,"duration":287.8,"weight_name":"duration","weight":287.8}],"waypoints":[{"hint":"d89TgaHPU4GmAQAAGwIAAB0AAADAAQAApgEAABsCAAAdAAAAwAEAAAIAAAAXIzsAiUuZAoojOwCTS5kCAQDPCg61bn8=","name":"","location":[3.875607,43.600777]},{"hint":"dNRTgZbUU4FHAAAAuAEAAIMAAAAAAAAARwAAALgBAACDAAAAAAAAAAIAAABJHDsA1ESZAkocOwAdRJkCAwCfBQ61bn8=","name":"Rue du Docteur Louis Perrier","location":[3.873865,43.59906]}]}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/osm"
|
|
12
12
|
},
|
|
13
13
|
"name": "@wemap/osm",
|
|
14
|
-
"version": "0.2.
|
|
14
|
+
"version": "0.2.10",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/wemap/wemap-utils-js/issues"
|
|
17
17
|
},
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@wemap/geo": "^0.3.
|
|
29
|
+
"@wemap/geo": "^0.3.8",
|
|
30
30
|
"@wemap/logger": "^0.1.6",
|
|
31
31
|
"lodash.isnumber": "^3.0.3",
|
|
32
32
|
"sax": "^1.2.4"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "6e107eebc85ff97f17371feac903ddb53657678b"
|
|
35
35
|
}
|
|
@@ -60,8 +60,8 @@ class OsmNetwork extends Network {
|
|
|
60
60
|
return this.edges.find(edge => edge.data.id === id);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
return super.
|
|
63
|
+
toDetailedString() {
|
|
64
|
+
return super.toDetailedString(
|
|
65
65
|
node => node.data.tags.name,
|
|
66
66
|
edge => edge.data.id
|
|
67
67
|
);
|
package/src/osrm/OsrmUtils.js
CHANGED
|
@@ -175,18 +175,41 @@ class OsrmUtils {
|
|
|
175
175
|
|
|
176
176
|
for (let i = 0; i < steps.length; i++) {
|
|
177
177
|
const step = steps[i];
|
|
178
|
+
|
|
179
|
+
const nodeData = {};
|
|
180
|
+
const nextEdgeData = {};
|
|
181
|
+
|
|
178
182
|
if (step.wemap) {
|
|
183
|
+
if (step.wemap.nodeTags) {
|
|
184
|
+
nodeData.tags = step.wemap.nodeTags;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (step.wemap.nextEdgeTags) {
|
|
188
|
+
nextEdgeData.osmTags = step.wemap.nextEdgeTags;
|
|
189
|
+
if (nextEdgeData.osmTags.name) {
|
|
190
|
+
nextEdgeData.name = nextEdgeData.osmTags.name;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (step.name) {
|
|
196
|
+
nextEdgeData.name = step.name;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const hasNodeData = Object.keys(nodeData).length !== 0;
|
|
200
|
+
const hasNextEdgeData = Object.keys(nextEdgeData).length !== 0;
|
|
201
|
+
if (hasNodeData || hasNextEdgeData) {
|
|
179
202
|
const stepLocation = step.maneuver.location;
|
|
180
203
|
const location = OsrmUtils.jsonToWgs84(stepLocation);
|
|
181
204
|
const existingNode = itinerary.getNodeByCoords(location);
|
|
182
205
|
|
|
183
|
-
if (
|
|
184
|
-
existingNode.data =
|
|
206
|
+
if (hasNodeData) {
|
|
207
|
+
existingNode.data = nodeData;
|
|
185
208
|
}
|
|
186
209
|
|
|
187
|
-
if (
|
|
210
|
+
if (hasNextEdgeData && i !== steps.length - 1) {
|
|
188
211
|
const nextEdge = existingNode.edges[i === 0 ? 0 : 1];
|
|
189
|
-
nextEdge.data =
|
|
212
|
+
nextEdge.data = nextEdgeData;
|
|
190
213
|
}
|
|
191
214
|
}
|
|
192
215
|
}
|
|
@@ -24,8 +24,8 @@ describe('OsrmUtils', () => {
|
|
|
24
24
|
|
|
25
25
|
const json = JSON.parse(fileString);
|
|
26
26
|
|
|
27
|
-
const start = [3.
|
|
28
|
-
const end = [3.
|
|
27
|
+
const start = [3.8757218000000004, 43.6007871];
|
|
28
|
+
const end = [3.873866, 43.598877];
|
|
29
29
|
|
|
30
30
|
const itinerary = OsrmUtils.createItineraryFromJson(json, start, end);
|
|
31
31
|
|