New tidying and gaps parameters.
This commit is contained in:
parent
836a5066c2
commit
2fab696bb3
@ -274,12 +274,13 @@ In addition to the [general options](#general-options) the following options are
|
||||
|Option |Values |Description |
|
||||
|------------|------------------------------------------------|------------------------------------------------------------------------------------------|
|
||||
|steps |`true`, `false` (default) |Return route steps for each route |
|
||||
|preprocess |`full`, `simple` (default), `false` |Allows the input track modification to obtain better matching quality for noisy tracks. |
|
||||
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|
||||
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|
||||
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|
||||
|timestamps |`{timestamp};{timestamp}[;{timestamp} ...]` |Timestamps for the input locations in seconds since UNIX epoch. Timestamps need to be monotonically increasing. |
|
||||
|radiuses |`{radius};{radius}[;{radius} ...]` |Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy.|
|
||||
|gaps |`split` (default), `ignore` |Allows the input track splitting based on huge timestamp gaps between points. |
|
||||
|tidying |`true`, `false` (default) |Allows the input track modification to obtain better matching quality for noisy tracks. |
|
||||
|
||||
|Parameter |Values |
|
||||
|------------|-----------------------------------|
|
||||
|
@ -50,11 +50,10 @@ namespace api
|
||||
*/
|
||||
struct MatchParameters : public RouteParameters
|
||||
{
|
||||
enum class PreprocessingType
|
||||
enum class GapsType
|
||||
{
|
||||
False,
|
||||
Simple,
|
||||
Full
|
||||
Split,
|
||||
Ignore
|
||||
};
|
||||
|
||||
MatchParameters()
|
||||
@ -64,21 +63,23 @@ struct MatchParameters : public RouteParameters
|
||||
RouteParameters::GeometriesType::Polyline,
|
||||
RouteParameters::OverviewType::Simplified,
|
||||
{}),
|
||||
track_preprocessing(PreprocessingType::Simple)
|
||||
gaps_processing(GapsType::Split), use_tidying(false)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
MatchParameters(std::vector<unsigned> timestamps_,
|
||||
PreprocessingType track_preprocessing_,
|
||||
GapsType gaps_processing_,
|
||||
bool use_tidying_,
|
||||
Args... args_)
|
||||
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)},
|
||||
track_preprocessing(track_preprocessing_)
|
||||
gaps_processing(gaps_processing_), use_tidying(use_tidying_)
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<unsigned> timestamps;
|
||||
PreprocessingType track_preprocessing;
|
||||
GapsType gaps_processing;
|
||||
bool use_tidying;
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ class RoutingAlgorithmsInterface
|
||||
const std::vector<util::Coordinate> &trace_coordinates,
|
||||
const std::vector<unsigned> &trace_timestamps,
|
||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
||||
const bool use_tidying) const = 0;
|
||||
const bool allow_splitting) const = 0;
|
||||
|
||||
virtual std::vector<routing_algorithms::TurnData>
|
||||
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
|
||||
@ -85,7 +85,7 @@ template <typename AlgorithmT> class RoutingAlgorithms final : public RoutingAlg
|
||||
const std::vector<util::Coordinate> &trace_coordinates,
|
||||
const std::vector<unsigned> &trace_timestamps,
|
||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
||||
const bool use_tidying) const final override;
|
||||
const bool allow_splitting) const final override;
|
||||
|
||||
std::vector<routing_algorithms::TurnData>
|
||||
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
|
||||
@ -166,7 +166,7 @@ inline routing_algorithms::SubMatchingList RoutingAlgorithms<AlgorithmT>::MapMat
|
||||
const std::vector<util::Coordinate> &trace_coordinates,
|
||||
const std::vector<unsigned> &trace_timestamps,
|
||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
||||
const bool use_tidying) const
|
||||
const bool allow_splitting) const
|
||||
{
|
||||
return routing_algorithms::mapMatching(heaps,
|
||||
facade,
|
||||
@ -174,7 +174,7 @@ inline routing_algorithms::SubMatchingList RoutingAlgorithms<AlgorithmT>::MapMat
|
||||
trace_coordinates,
|
||||
trace_timestamps,
|
||||
trace_gps_precision,
|
||||
use_tidying);
|
||||
allow_splitting);
|
||||
}
|
||||
|
||||
template <typename AlgorithmT>
|
||||
|
@ -29,7 +29,7 @@ mapMatching(SearchEngineData &engine_working_data,
|
||||
const std::vector<util::Coordinate> &trace_coordinates,
|
||||
const std::vector<unsigned> &trace_timestamps,
|
||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
||||
const bool use_tidying);
|
||||
const bool allow_splitting);
|
||||
|
||||
SubMatchingList
|
||||
mapMatching(SearchEngineData &engine_working_data,
|
||||
@ -38,7 +38,7 @@ mapMatching(SearchEngineData &engine_working_data,
|
||||
const std::vector<util::Coordinate> &trace_coordinates,
|
||||
const std::vector<unsigned> &trace_timestamps,
|
||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
||||
const bool use_tidying);
|
||||
const bool allow_splitting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,17 +33,18 @@ struct MatchParametersGrammar final : public RouteParametersGrammar<Iterator, Si
|
||||
(qi::uint_ %
|
||||
';')[ph::bind(&engine::api::MatchParameters::timestamps, qi::_r1) = qi::_1];
|
||||
|
||||
preprocessing_type.add("simple", engine::api::MatchParameters::PreprocessingType::Simple)(
|
||||
"full", engine::api::MatchParameters::PreprocessingType::Full)(
|
||||
"false", engine::api::MatchParameters::PreprocessingType::False);
|
||||
gaps_type.add("split", engine::api::MatchParameters::GapsType::Split)(
|
||||
"ignore", engine::api::MatchParameters::GapsType::Ignore);
|
||||
|
||||
root_rule =
|
||||
BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") >
|
||||
-('?' >
|
||||
(timestamps_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) |
|
||||
(qi::lit("preprocess=") >
|
||||
preprocessing_type[ph::bind(&engine::api::MatchParameters::track_preprocessing,
|
||||
qi::_r1) = qi::_1])) %
|
||||
(qi::lit("gaps=") >
|
||||
gaps_type[ph::bind(&engine::api::MatchParameters::gaps_processing, qi::_r1) =
|
||||
qi::_1]) |
|
||||
(qi::lit("tidying=") > qi::bool_[ph::bind(&engine::api::MatchParameters::use_tidying,
|
||||
qi::_r1) = qi::_1])) %
|
||||
'&');
|
||||
}
|
||||
|
||||
@ -51,7 +52,7 @@ struct MatchParametersGrammar final : public RouteParametersGrammar<Iterator, Si
|
||||
qi::rule<Iterator, Signature> root_rule;
|
||||
qi::rule<Iterator, Signature> timestamps_rule;
|
||||
|
||||
qi::symbols<char, engine::api::MatchParameters::PreprocessingType> preprocessing_type;
|
||||
qi::symbols<char, engine::api::MatchParameters::GapsType> gaps_type;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
||||
}
|
||||
|
||||
SubMatchingList sub_matchings;
|
||||
if (parameters.track_preprocessing == api::MatchParameters::PreprocessingType::Full)
|
||||
if (parameters.use_tidying)
|
||||
{
|
||||
// Transparently tidy match parameters, do map matching on tidied parameters.
|
||||
// Then use the mapping to restore the original <-> tidied relationship.
|
||||
@ -197,12 +197,12 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
||||
}
|
||||
|
||||
// call the actual map matching
|
||||
sub_matchings = algorithms.MapMatching(
|
||||
candidates_lists,
|
||||
tidied.parameters.coordinates,
|
||||
tidied.parameters.timestamps,
|
||||
tidied.parameters.radiuses,
|
||||
!(parameters.track_preprocessing == api::MatchParameters::PreprocessingType::False));
|
||||
sub_matchings = algorithms.MapMatching(candidates_lists,
|
||||
tidied.parameters.coordinates,
|
||||
tidied.parameters.timestamps,
|
||||
tidied.parameters.radiuses,
|
||||
parameters.gaps_processing ==
|
||||
api::MatchParameters::GapsType::Split);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -222,12 +222,12 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
||||
}
|
||||
|
||||
// call the actual map matching
|
||||
sub_matchings = algorithms.MapMatching(
|
||||
candidates_lists,
|
||||
parameters.coordinates,
|
||||
parameters.timestamps,
|
||||
parameters.radiuses,
|
||||
!(parameters.track_preprocessing == api::MatchParameters::PreprocessingType::False));
|
||||
sub_matchings = algorithms.MapMatching(candidates_lists,
|
||||
parameters.coordinates,
|
||||
parameters.timestamps,
|
||||
parameters.radiuses,
|
||||
parameters.gaps_processing ==
|
||||
api::MatchParameters::GapsType::Split);
|
||||
}
|
||||
|
||||
if (sub_matchings.size() == 0)
|
||||
|
@ -55,7 +55,7 @@ mapMatchingImpl(SearchEngineData &engine_working_data,
|
||||
const std::vector<util::Coordinate> &trace_coordinates,
|
||||
const std::vector<unsigned> &trace_timestamps,
|
||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
||||
const bool use_tidying)
|
||||
const bool allow_splitting)
|
||||
{
|
||||
map_matching::MatchingConfidence confidence;
|
||||
map_matching::EmissionLogProbability default_emission_log_probability(DEFAULT_GPS_PRECISION);
|
||||
@ -159,11 +159,7 @@ mapMatchingImpl(SearchEngineData &engine_working_data,
|
||||
|
||||
const bool gap_in_trace = [&]() {
|
||||
// do not determine split if wasn't asked about it
|
||||
if (!use_tidying)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (allow_splitting)
|
||||
{
|
||||
// use temporal information if available to determine a split
|
||||
if (use_timestamps)
|
||||
@ -176,6 +172,10 @@ mapMatchingImpl(SearchEngineData &engine_working_data,
|
||||
return t - prev_unbroken_timestamps.back() > MAX_BROKEN_STATES;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}();
|
||||
|
||||
if (!gap_in_trace)
|
||||
|
Loading…
Reference in New Issue
Block a user