Turn Angles in OSRM were computed using a lookahead of 10 meters.
This PR adds more advanced coordinate extraction, analysing the road to detect offsets due to OSM way modelling. In addition it improves the handling of bearings. Right now OSM reports bearings simply based on the very first coordinate along a way. With this PR, we store the bearings for a turn correctly, making the bearings for turns correct.
This commit is contained in:
@@ -164,7 +164,8 @@ void CompressedEdgeContainer::CompressEdge(const EdgeID edge_id_1,
|
||||
BOOST_ASSERT(edge_bucket_id1 == GetPositionForID(edge_id_1));
|
||||
BOOST_ASSERT(edge_bucket_id1 < m_compressed_oneway_geometries.size());
|
||||
|
||||
std::vector<OnewayCompressedEdge> &edge_bucket_list1 = m_compressed_oneway_geometries[edge_bucket_id1];
|
||||
std::vector<OnewayCompressedEdge> &edge_bucket_list1 =
|
||||
m_compressed_oneway_geometries[edge_bucket_id1];
|
||||
|
||||
// note we don't save the start coordinate: it is implicitly given by edge 1
|
||||
// weight1 is the distance to the (currently) last coordinate in the bucket
|
||||
@@ -235,7 +236,8 @@ void CompressedEdgeContainer::AddUncompressedEdge(const EdgeID edge_id,
|
||||
BOOST_ASSERT(edge_bucket_id == GetPositionForID(edge_id));
|
||||
BOOST_ASSERT(edge_bucket_id < m_compressed_oneway_geometries.size());
|
||||
|
||||
std::vector<OnewayCompressedEdge> &edge_bucket_list = m_compressed_oneway_geometries[edge_bucket_id];
|
||||
std::vector<OnewayCompressedEdge> &edge_bucket_list =
|
||||
m_compressed_oneway_geometries[edge_bucket_id];
|
||||
|
||||
// note we don't save the start coordinate: it is implicitly given by edge_id
|
||||
// weight is the distance to the (currently) last coordinate in the bucket
|
||||
@@ -264,7 +266,8 @@ unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id, const EdgeID
|
||||
|
||||
std::vector<CompressedEdge> zipped_edge_bucket;
|
||||
const auto &first_node = reverse_bucket.back();
|
||||
zipped_edge_bucket.emplace_back(CompressedEdge{first_node.node_id, INVALID_EDGE_WEIGHT, first_node.weight});
|
||||
zipped_edge_bucket.emplace_back(
|
||||
CompressedEdge{first_node.node_id, INVALID_EDGE_WEIGHT, first_node.weight});
|
||||
|
||||
for (std::size_t i = 0; i < forward_bucket.size() - 1; ++i)
|
||||
{
|
||||
@@ -273,11 +276,13 @@ unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id, const EdgeID
|
||||
|
||||
BOOST_ASSERT(fwd_node.node_id == rev_node.node_id);
|
||||
|
||||
zipped_edge_bucket.emplace_back(CompressedEdge{fwd_node.node_id, fwd_node.weight, rev_node.weight});
|
||||
zipped_edge_bucket.emplace_back(
|
||||
CompressedEdge{fwd_node.node_id, fwd_node.weight, rev_node.weight});
|
||||
}
|
||||
|
||||
const auto &last_node = forward_bucket.back();
|
||||
zipped_edge_bucket.emplace_back(CompressedEdge{last_node.node_id, last_node.weight, INVALID_EDGE_WEIGHT});
|
||||
zipped_edge_bucket.emplace_back(
|
||||
CompressedEdge{last_node.node_id, last_node.weight, INVALID_EDGE_WEIGHT});
|
||||
m_compressed_geometries.emplace_back(std::move(zipped_edge_bucket));
|
||||
|
||||
return zipped_geometry_id;
|
||||
|
||||
Reference in New Issue
Block a user