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:
@@ -32,6 +32,12 @@ inline double angularDeviation(const double angle, const double from)
|
||||
return std::min(360 - deviation, deviation);
|
||||
}
|
||||
|
||||
inline bool hasRampType(const extractor::guidance::TurnInstruction instruction)
|
||||
{
|
||||
return instruction.type == extractor::guidance::TurnType::OffRamp ||
|
||||
instruction.type == extractor::guidance::TurnType::OnRamp;
|
||||
}
|
||||
|
||||
inline extractor::guidance::DirectionModifier::Enum getTurnDirection(const double angle)
|
||||
{
|
||||
// An angle of zero is a u-turn
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef OSRM_INCLUDE_UTIL_TURN_BEARING_HPP_
|
||||
#define OSRM_INCLUDE_UTIL_TURN_BEARING_HPP_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
|
||||
#pragma pack(push, 1)
|
||||
class TurnBearing
|
||||
{
|
||||
public:
|
||||
TurnBearing(const double value = 0);
|
||||
|
||||
double Get() const;
|
||||
|
||||
private:
|
||||
std::uint8_t bearing;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
} // namespace guidance
|
||||
} // namespace util
|
||||
} // namespace osrm
|
||||
|
||||
#endif /* OSRM_INCLUDE_UTIL_TURN_BEARING_HPP_ */
|
||||
Reference in New Issue
Block a user