@wemap/routers 11.3.3 → 11.4.0
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 +15 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/remote/osrm/OsrmRemoteRouter.ts +12 -5
- package/src/wemap-multi/WemapMultiRouter.ts +5 -5
package/dist/index.js
CHANGED
|
@@ -1475,8 +1475,8 @@ class OsrmRemoteRouter extends RemoteRouter {
|
|
|
1475
1475
|
get rname() {
|
|
1476
1476
|
return "osrm";
|
|
1477
1477
|
}
|
|
1478
|
-
async getItineraries(endpointUrl, mode, waypoints) {
|
|
1479
|
-
const url = this.getURL(endpointUrl, mode, waypoints);
|
|
1478
|
+
async getItineraries(endpointUrl, mode, waypoints, options = {}) {
|
|
1479
|
+
const url = this.getURL(endpointUrl, mode, waypoints, options);
|
|
1480
1480
|
const res = await fetch(url).catch(() => {
|
|
1481
1481
|
throw new RemoteRouterServerUnreachable(this.rname, url);
|
|
1482
1482
|
});
|
|
@@ -1488,11 +1488,14 @@ class OsrmRemoteRouter extends RemoteRouter {
|
|
|
1488
1488
|
const osrmMode = inputModeCorrespondance$1.get(mode);
|
|
1489
1489
|
return this.createRouterResponseFromJson(jsonResponse, from, to, osrmMode);
|
|
1490
1490
|
}
|
|
1491
|
-
getURL(endpointUrl, mode, waypoints) {
|
|
1492
|
-
|
|
1491
|
+
getURL(endpointUrl, mode, waypoints, options = {}) {
|
|
1492
|
+
let osrmMode = inputModeCorrespondance$1.get(mode);
|
|
1493
1493
|
if (!osrmMode) {
|
|
1494
1494
|
throw new RoutingModeCorrespondanceNotFound(this.rname, mode);
|
|
1495
1495
|
}
|
|
1496
|
+
if ("useStairs" in options && !options.useStairs) {
|
|
1497
|
+
osrmMode = "pmr";
|
|
1498
|
+
}
|
|
1496
1499
|
let url = endpointUrl + "/route/v1/" + osrmMode + "/";
|
|
1497
1500
|
url += waypoints.map((waypoint) => [waypoint.longitude + "," + waypoint.latitude]).join(";");
|
|
1498
1501
|
url += "?geometries=geojson&overview=full&steps=true";
|
|
@@ -1930,7 +1933,7 @@ class WemapMultiRouter {
|
|
|
1930
1933
|
const ioMapsToTest = this.getIoMapsFromOptions(options);
|
|
1931
1934
|
if (!ioMapsToTest.length) {
|
|
1932
1935
|
try {
|
|
1933
|
-
return await RemoteRouterManager$1.getItinerariesWithFallback(remoteRouters2, mode, waypoints);
|
|
1936
|
+
return await RemoteRouterManager$1.getItinerariesWithFallback(remoteRouters2, mode, waypoints, options || void 0);
|
|
1934
1937
|
} catch (e) {
|
|
1935
1938
|
if (!isRoutingError(e)) {
|
|
1936
1939
|
throw e;
|
|
@@ -1960,7 +1963,7 @@ class WemapMultiRouter {
|
|
|
1960
1963
|
let remoteRouterResponse;
|
|
1961
1964
|
if (!mapWithStart && !mapWithEnd) {
|
|
1962
1965
|
try {
|
|
1963
|
-
return await RemoteRouterManager$1.getItinerariesWithFallback(remoteRouters2, mode, waypoints);
|
|
1966
|
+
return await RemoteRouterManager$1.getItinerariesWithFallback(remoteRouters2, mode, waypoints, options || void 0);
|
|
1964
1967
|
} catch (e) {
|
|
1965
1968
|
if (!isRoutingError(e)) {
|
|
1966
1969
|
throw e;
|
|
@@ -1980,7 +1983,8 @@ class WemapMultiRouter {
|
|
|
1980
1983
|
remoteRouterResponse = await RemoteRouterManager$1.getItinerariesWithFallback(
|
|
1981
1984
|
remoteRouters2,
|
|
1982
1985
|
mode,
|
|
1983
|
-
[ioMapItinerary.to, end]
|
|
1986
|
+
[ioMapItinerary.to, end],
|
|
1987
|
+
options || void 0
|
|
1984
1988
|
);
|
|
1985
1989
|
if (!remoteRouterResponse.itineraries.length) {
|
|
1986
1990
|
throw new geo.NoRouteFoundError(ioMapItinerary.to, end, remoteRouterResponse.error);
|
|
@@ -2009,7 +2013,8 @@ class WemapMultiRouter {
|
|
|
2009
2013
|
remoteRouterResponse = await RemoteRouterManager$1.getItinerariesWithFallback(
|
|
2010
2014
|
remoteRouters2,
|
|
2011
2015
|
mode,
|
|
2012
|
-
[start, ioMapItinerary.from]
|
|
2016
|
+
[start, ioMapItinerary.from],
|
|
2017
|
+
options || void 0
|
|
2013
2018
|
);
|
|
2014
2019
|
if (!remoteRouterResponse.itineraries.length) {
|
|
2015
2020
|
throw new geo.NoRouteFoundError(start, ioMapItinerary.from, remoteRouterResponse.error);
|
|
@@ -2047,7 +2052,8 @@ class WemapMultiRouter {
|
|
|
2047
2052
|
remoteRouterResponse = await RemoteRouterManager$1.getItinerariesWithFallback(
|
|
2048
2053
|
remoteRouters2,
|
|
2049
2054
|
mode,
|
|
2050
|
-
[ioMapItinerary1.to, ioMapItinerary2.from]
|
|
2055
|
+
[ioMapItinerary1.to, ioMapItinerary2.from],
|
|
2056
|
+
options || void 0
|
|
2051
2057
|
);
|
|
2052
2058
|
if (!remoteRouterResponse.itineraries.length) {
|
|
2053
2059
|
throw new geo.NoRouteFoundError(ioMapItinerary1.to, ioMapItinerary2.from, remoteRouterResponse.error);
|