From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:08:29 +0000 (+0200) Subject: Attach routing credit to route X-Git-Tag: live~48^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/b624e14755cacbef1325e39828bb783fab828983?ds=inline;hp=--cc Attach routing credit to route --- b624e14755cacbef1325e39828bb783fab828983 diff --git a/app/assets/javascripts/index/directions-route-output.js b/app/assets/javascripts/index/directions-route-output.js index 800181034..84bcc87a8 100644 --- a/app/assets/javascripts/index/directions-route-output.js +++ b/app/assets/javascripts/index/directions-route-output.js @@ -52,7 +52,7 @@ OSM.DirectionsRouteOutput = function (map) { const routeOutput = {}; - routeOutput.write = function (content, engine, route) { + routeOutput.write = function (content, route) { polyline .setLatLngs(route.line) .addTo(map); @@ -117,7 +117,9 @@ OSM.DirectionsRouteOutput = function (map) { }
`); content.append("" + - OSM.i18n.t("javascripts.directions.instructions.courtesy", { link: engine.creditline }) + + OSM.i18n.t("javascripts.directions.instructions.courtesy", { + link: `${route.credit}` + }) + "
"); }; diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index ba52d35b3..c5d5cce15 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -107,7 +107,7 @@ OSM.Directions = function (map) { map.setSidebarOverlaid(false); controller = new AbortController(); chosenEngine.getRoute(points, controller.signal).then(function (route) { - routeOutput.write($("#directions_content"), chosenEngine, route); + routeOutput.write($("#directions_content"), route); if (fitRoute) { routeOutput.fit(); } diff --git a/app/assets/javascripts/index/directions/fossgis_osrm.js b/app/assets/javascripts/index/directions/fossgis_osrm.js index 40181e588..53043e06d 100644 --- a/app/assets/javascripts/index/directions/fossgis_osrm.js +++ b/app/assets/javascripts/index/directions/fossgis_osrm.js @@ -146,14 +146,15 @@ line: steps.flatMap(step => step[3]), steps, distance: leg.distance, - time: leg.duration + time: leg.duration, + credit: "OSRM (FOSSGIS)", + creditlink: "https://routing.openstreetmap.de/about.html" }; } return { mode: modeId, provider: "fossgis_osrm", - creditline: "OSRM (FOSSGIS)", draggable: true, getRoute: function (points, signal) { diff --git a/app/assets/javascripts/index/directions/fossgis_valhalla.js b/app/assets/javascripts/index/directions/fossgis_valhalla.js index 2e1295657..7354e5d65 100644 --- a/app/assets/javascripts/index/directions/fossgis_valhalla.js +++ b/app/assets/javascripts/index/directions/fossgis_valhalla.js @@ -56,15 +56,15 @@ line, steps, distance: leg.summary.length * 1000, - time: leg.summary.time + time: leg.summary.time, + credit: "Valhalla (FOSSGIS)", + creditlink: "https://gis-ops.com/global-open-valhalla-server-online/" }; } return { mode: modeId, provider: "fossgis_valhalla", - creditline: - "Valhalla (FOSSGIS)", draggable: false, getRoute: function (points, signal) { diff --git a/app/assets/javascripts/index/directions/graphhopper.js b/app/assets/javascripts/index/directions/graphhopper.js index 182be4497..dd79a4671 100644 --- a/app/assets/javascripts/index/directions/graphhopper.js +++ b/app/assets/javascripts/index/directions/graphhopper.js @@ -35,14 +35,15 @@ distance: path.distance, time: path.time / 1000, ascend: path.ascend, - descend: path.descend + descend: path.descend, + credit: "GraphHopper", + creditlink: "https://www.graphhopper.com/" }; } return { mode: modeId, provider: "graphhopper", - creditline: "GraphHopper", draggable: false, getRoute: function (points, signal) {