From ade9b22e5607ae7f2405cd209838d174f2a45f20 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Tue, 2 Mar 2021 16:27:20 +0200 Subject: [PATCH 1/2] Fix Graphhopper server request preparation --- .../plus/onlinerouting/engine/GraphhopperEngine.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/engine/GraphhopperEngine.java b/OsmAnd/src/net/osmand/plus/onlinerouting/engine/GraphhopperEngine.java index ae62b8c71d..f86e8e66fc 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/engine/GraphhopperEngine.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/engine/GraphhopperEngine.java @@ -87,16 +87,19 @@ public class GraphhopperEngine extends JsonOnlineRoutingEngine { protected void makeFullUrl(@NonNull StringBuilder sb, @NonNull List path) { sb.append("?"); - for (LatLon point : path) { + for (int i = 0; i < path.size(); i++) { + LatLon point = path.get(i); sb.append("point=") .append(point.getLatitude()) .append(',') - .append(point.getLongitude()) - .append('&'); + .append(point.getLongitude()); + if (i < path.size() - 1) { + sb.append('&'); + } } String vehicle = get(EngineParameter.VEHICLE_KEY); if (!isEmpty(vehicle)) { - sb.append("vehicle=").append(vehicle); + sb.append('&').append("vehicle=").append(vehicle); } String apiKey = get(EngineParameter.API_KEY); if (!isEmpty(apiKey)) { From 16e631614eef269da4651698a3263737b45d4b29 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Tue, 2 Mar 2021 16:29:05 +0200 Subject: [PATCH 2/2] Fix Gpx online routing server request url preparation --- .../net/osmand/plus/onlinerouting/engine/GpxEngine.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/engine/GpxEngine.java b/OsmAnd/src/net/osmand/plus/onlinerouting/engine/GpxEngine.java index 736d09611a..6dc5ed6d88 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/engine/GpxEngine.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/engine/GpxEngine.java @@ -46,11 +46,15 @@ public class GpxEngine extends OnlineRoutingEngine { @Override protected void makeFullUrl(@NonNull StringBuilder sb, @NonNull List path) { + sb.append("?"); for (int i = 0; i < path.size(); i++) { LatLon point = path.get(i); - sb.append(point.getLongitude()).append(',').append(point.getLatitude()); + sb.append("point=") + .append(point.getLatitude()) + .append(',') + .append(point.getLongitude()); if (i < path.size() - 1) { - sb.append(';'); + sb.append('&'); } } }