From 71b864e4b4f2e2ea58216c8adef44dfabb411749 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Tue, 8 Nov 2022 11:55:01 +0100 Subject: [PATCH] fix: ensure customParameters are always applied --- all/native/routing/utils/ValhallaRoutingProxy.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/all/native/routing/utils/ValhallaRoutingProxy.cpp b/all/native/routing/utils/ValhallaRoutingProxy.cpp index 9942cebb1..359047971 100644 --- a/all/native/routing/utils/ValhallaRoutingProxy.cpp +++ b/all/native/routing/utils/ValhallaRoutingProxy.cpp @@ -349,12 +349,8 @@ namespace carto { locations.emplace_back(location); } - picojson::value customParams = request->getCustomParameters().toPicoJSON(); picojson::object json; - if (customParams.is()) { - json = customParams.get(); - } json["shape"] = picojson::value(locations); json["shape_match"] = picojson::value("map_snap"); json["costing"] = picojson::value(profile); @@ -362,6 +358,13 @@ namespace carto { if (request->getAccuracy() > 0) { json["gps_accuracy"] = picojson::value(request->getAccuracy()); } + picojson::value customParams = request->getCustomParameters().toPicoJSON(); + if (customParams.is()) { + const picojson::object& customParamsObj = customParams.get(); + for (auto it = customParamsObj.begin(); it != customParamsObj.end(); it++) { + json[it->first] = it->second; + } + } return picojson::value(json).serialize(); }