@wemap/routers 12.0.0-alpha.13 → 12.0.0-alpha.15
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/dist/index.js
CHANGED
|
@@ -1023,6 +1023,54 @@ class GraphRouterEngineResults {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
return new GraphRoute(this.source.coords, to.coords, path, edges, edgesWeights);
|
|
1025
1025
|
}
|
|
1026
|
+
toGeoJson(graph) {
|
|
1027
|
+
return {
|
|
1028
|
+
type: "FeatureCollection",
|
|
1029
|
+
features: [
|
|
1030
|
+
...graph.vertices.map((v) => {
|
|
1031
|
+
const prev = this.prev[v.id];
|
|
1032
|
+
const dist = this.dist[v.id];
|
|
1033
|
+
const isSource = v === this.source;
|
|
1034
|
+
const isTarget = this.targets.includes(v);
|
|
1035
|
+
const level = v.coords.level;
|
|
1036
|
+
return {
|
|
1037
|
+
type: "Feature",
|
|
1038
|
+
properties: {
|
|
1039
|
+
id: v.id,
|
|
1040
|
+
...prev && { prev: prev.id },
|
|
1041
|
+
dist: dist === Number.MAX_VALUE ? "infinity" : dist,
|
|
1042
|
+
...isSource && { name: "source" },
|
|
1043
|
+
...isTarget && { name: "target" },
|
|
1044
|
+
...level !== null && { level },
|
|
1045
|
+
...v.properties
|
|
1046
|
+
},
|
|
1047
|
+
geometry: {
|
|
1048
|
+
type: "Point",
|
|
1049
|
+
coordinates: [v.coords.lng, v.coords.lat]
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
}),
|
|
1053
|
+
...graph.edges.map((e) => {
|
|
1054
|
+
const level = e.level;
|
|
1055
|
+
return {
|
|
1056
|
+
type: "Feature",
|
|
1057
|
+
properties: {
|
|
1058
|
+
id: e.id,
|
|
1059
|
+
...level !== null && { level },
|
|
1060
|
+
...e.properties
|
|
1061
|
+
},
|
|
1062
|
+
geometry: {
|
|
1063
|
+
type: "LineString",
|
|
1064
|
+
coordinates: [
|
|
1065
|
+
[e.vertex1.coords.lng, e.vertex1.coords.lat],
|
|
1066
|
+
[e.vertex2.coords.lng, e.vertex2.coords.lat]
|
|
1067
|
+
]
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
})
|
|
1071
|
+
]
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1026
1074
|
}
|
|
1027
1075
|
class GraphRouterEngine {
|
|
1028
1076
|
constructor(graph) {
|
|
@@ -1382,10 +1430,12 @@ const _OsmGraphUtils = class _OsmGraphUtils {
|
|
|
1382
1430
|
return new Graph(verticesMapping.map((v) => v[1]), edges);
|
|
1383
1431
|
}
|
|
1384
1432
|
};
|
|
1385
|
-
__publicField(_OsmGraphUtils, "
|
|
1433
|
+
__publicField(_OsmGraphUtils, "RESTRICTED_PEDESTRIANS_HIGHWAYS", ["motorway", "motorway_link"]);
|
|
1386
1434
|
__publicField(_OsmGraphUtils, "DEFAULT_WAY_SELECTOR", (way) => {
|
|
1387
|
-
|
|
1388
|
-
|
|
1435
|
+
if (way.isArea)
|
|
1436
|
+
return false;
|
|
1437
|
+
const isElevatorArea = way.tags.highway === "elevator" && way.isGeometryClosed;
|
|
1438
|
+
return way.tags.highway && !_OsmGraphUtils.RESTRICTED_PEDESTRIANS_HIGHWAYS.includes(way.tags.highway) && !isElevatorArea && !["no", "private"].includes(way.tags.access) || way.tags.footway === "sidewalk" || way.tags.public_transport === "platform" || way.tags.railway === "platform";
|
|
1389
1439
|
});
|
|
1390
1440
|
let OsmGraphUtils = _OsmGraphUtils;
|
|
1391
1441
|
class RemoteRouter {
|
|
@@ -2639,6 +2689,7 @@ class CustomNetworkMap {
|
|
|
2639
2689
|
return vertex || null;
|
|
2640
2690
|
});
|
|
2641
2691
|
const entryPoints = entryPointsToCheck.filter((it) => it !== null);
|
|
2692
|
+
entryPoints.forEach((v) => graph.exitVertices.add(v));
|
|
2642
2693
|
const bounds = {
|
|
2643
2694
|
type: "MultiPolygon",
|
|
2644
2695
|
coordinates: []
|