From 573f1104926d3f8db5596969cdd7d5c0115c5642 Mon Sep 17 00:00:00 2001 From: "muteeb.ali@synergy-it.com" Date: Fri, 4 Oct 2024 13:14:33 +0500 Subject: [PATCH 1/2] #7047: Nearest api returning node with id 0 --- include/engine/api/nearest_api.hpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/include/engine/api/nearest_api.hpp b/include/engine/api/nearest_api.hpp index 0e2a9edbf..779e29356 100644 --- a/include/engine/api/nearest_api.hpp +++ b/include/engine/api/nearest_api.hpp @@ -149,13 +149,23 @@ class NearestAPI final : public BaseAPI facade.GetOSMNodeIDOfNode(geometry(phantom_node.fwd_segment_position + 1)); from_node = static_cast(osm_node_id); } - else if (phantom_node.forward_segment_id.enabled && phantom_node.fwd_segment_position > 0) + else if (phantom_node.forward_segment_id.enabled) { // In the case of one way, rely on forward segment only - auto osm_node_id = - facade.GetOSMNodeIDOfNode(forward_geometry(phantom_node.fwd_segment_position - 1)); + if (phantom_node.fwd_segment_position > 0) + { + auto osm_node_id = facade.GetOSMNodeIDOfNode( + forward_geometry(phantom_node.fwd_segment_position - 1)); from_node = static_cast(osm_node_id); } + else if (phantom_node.fwd_segment_position == 0) + { + auto osm_node_id = facade.GetOSMNodeIDOfNode( + forward_geometry(phantom_node.fwd_segment_position + 1)); + from_node = to_node; + to_node = static_cast(osm_node_id); + } + } return std::make_pair(from_node, to_node); } From ec990e1fed3b5c7116d6ac61caa2d2678651844a Mon Sep 17 00:00:00 2001 From: Muteeb Ali <31405887+muteebali@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:43:59 +0500 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 954dcc627..18f0de7d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ - FIXED: Ensure required file check in osrm-routed is correctly enforced. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655) - FIXED: Correct HTTP docs to reflect summary output dependency on steps parameter. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655) - ADDED: Extract prerelease/build information from package semver [#6839](https://github.com/Project-OSRM/osrm-backend/pull/6839) + - FIXED: Nearest api returning node with id 0 [#7047](https://github.com/Project-OSRM/osrm-backend/issues/7047) - Profiles: - FIXED: Bicycle and foot profiles now don't route on proposed ways [#6615](https://github.com/Project-OSRM/osrm-backend/pull/6615) - ADDED: Add optional support of cargo bike exclusion and width to bicyle profile [#7044](https://github.com/Project-OSRM/osrm-backend/pull/7044)