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 |
|
|Option |Values |Description |
|
||||||
|------------|------------------------------------------------|------------------------------------------------------------------------------------------|
|
|------------|------------------------------------------------|------------------------------------------------------------------------------------------|
|
||||||
|steps |`true`, `false` (default) |Return route steps for each route |
|
|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) |
|
|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. |
|
|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.|
|
|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. |
|
|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.|
|
|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 |
|
|Parameter |Values |
|
||||||
|------------|-----------------------------------|
|
|------------|-----------------------------------|
|
||||||
|
@ -50,11 +50,10 @@ namespace api
|
|||||||
*/
|
*/
|
||||||
struct MatchParameters : public RouteParameters
|
struct MatchParameters : public RouteParameters
|
||||||
{
|
{
|
||||||
enum class PreprocessingType
|
enum class GapsType
|
||||||
{
|
{
|
||||||
False,
|
Split,
|
||||||
Simple,
|
Ignore
|
||||||
Full
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MatchParameters()
|
MatchParameters()
|
||||||
@ -64,21 +63,23 @@ struct MatchParameters : public RouteParameters
|
|||||||
RouteParameters::GeometriesType::Polyline,
|
RouteParameters::GeometriesType::Polyline,
|
||||||
RouteParameters::OverviewType::Simplified,
|
RouteParameters::OverviewType::Simplified,
|
||||||
{}),
|
{}),
|
||||||
track_preprocessing(PreprocessingType::Simple)
|
gaps_processing(GapsType::Split), use_tidying(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
MatchParameters(std::vector<unsigned> timestamps_,
|
MatchParameters(std::vector<unsigned> timestamps_,
|
||||||
PreprocessingType track_preprocessing_,
|
GapsType gaps_processing_,
|
||||||
|
bool use_tidying_,
|
||||||
Args... args_)
|
Args... args_)
|
||||||
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)},
|
: 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;
|
std::vector<unsigned> timestamps;
|
||||||
PreprocessingType track_preprocessing;
|
GapsType gaps_processing;
|
||||||
|
bool use_tidying;
|
||||||
|
|
||||||
bool IsValid() const
|
bool IsValid() const
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ class RoutingAlgorithmsInterface
|
|||||||
const std::vector<util::Coordinate> &trace_coordinates,
|
const std::vector<util::Coordinate> &trace_coordinates,
|
||||||
const std::vector<unsigned> &trace_timestamps,
|
const std::vector<unsigned> &trace_timestamps,
|
||||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
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>
|
virtual std::vector<routing_algorithms::TurnData>
|
||||||
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
|
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<util::Coordinate> &trace_coordinates,
|
||||||
const std::vector<unsigned> &trace_timestamps,
|
const std::vector<unsigned> &trace_timestamps,
|
||||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
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>
|
std::vector<routing_algorithms::TurnData>
|
||||||
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
|
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<util::Coordinate> &trace_coordinates,
|
||||||
const std::vector<unsigned> &trace_timestamps,
|
const std::vector<unsigned> &trace_timestamps,
|
||||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
const std::vector<boost::optional<double>> &trace_gps_precision,
|
||||||
const bool use_tidying) const
|
const bool allow_splitting) const
|
||||||
{
|
{
|
||||||
return routing_algorithms::mapMatching(heaps,
|
return routing_algorithms::mapMatching(heaps,
|
||||||
facade,
|
facade,
|
||||||
@ -174,7 +174,7 @@ inline routing_algorithms::SubMatchingList RoutingAlgorithms<AlgorithmT>::MapMat
|
|||||||
trace_coordinates,
|
trace_coordinates,
|
||||||
trace_timestamps,
|
trace_timestamps,
|
||||||
trace_gps_precision,
|
trace_gps_precision,
|
||||||
use_tidying);
|
allow_splitting);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename AlgorithmT>
|
template <typename AlgorithmT>
|
||||||
|
@ -29,7 +29,7 @@ mapMatching(SearchEngineData &engine_working_data,
|
|||||||
const std::vector<util::Coordinate> &trace_coordinates,
|
const std::vector<util::Coordinate> &trace_coordinates,
|
||||||
const std::vector<unsigned> &trace_timestamps,
|
const std::vector<unsigned> &trace_timestamps,
|
||||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
const std::vector<boost::optional<double>> &trace_gps_precision,
|
||||||
const bool use_tidying);
|
const bool allow_splitting);
|
||||||
|
|
||||||
SubMatchingList
|
SubMatchingList
|
||||||
mapMatching(SearchEngineData &engine_working_data,
|
mapMatching(SearchEngineData &engine_working_data,
|
||||||
@ -38,7 +38,7 @@ mapMatching(SearchEngineData &engine_working_data,
|
|||||||
const std::vector<util::Coordinate> &trace_coordinates,
|
const std::vector<util::Coordinate> &trace_coordinates,
|
||||||
const std::vector<unsigned> &trace_timestamps,
|
const std::vector<unsigned> &trace_timestamps,
|
||||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
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_ %
|
(qi::uint_ %
|
||||||
';')[ph::bind(&engine::api::MatchParameters::timestamps, qi::_r1) = qi::_1];
|
';')[ph::bind(&engine::api::MatchParameters::timestamps, qi::_r1) = qi::_1];
|
||||||
|
|
||||||
preprocessing_type.add("simple", engine::api::MatchParameters::PreprocessingType::Simple)(
|
gaps_type.add("split", engine::api::MatchParameters::GapsType::Split)(
|
||||||
"full", engine::api::MatchParameters::PreprocessingType::Full)(
|
"ignore", engine::api::MatchParameters::GapsType::Ignore);
|
||||||
"false", engine::api::MatchParameters::PreprocessingType::False);
|
|
||||||
|
|
||||||
root_rule =
|
root_rule =
|
||||||
BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") >
|
BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") >
|
||||||
-('?' >
|
-('?' >
|
||||||
(timestamps_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) |
|
(timestamps_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) |
|
||||||
(qi::lit("preprocess=") >
|
(qi::lit("gaps=") >
|
||||||
preprocessing_type[ph::bind(&engine::api::MatchParameters::track_preprocessing,
|
gaps_type[ph::bind(&engine::api::MatchParameters::gaps_processing, qi::_r1) =
|
||||||
qi::_r1) = qi::_1])) %
|
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> root_rule;
|
||||||
qi::rule<Iterator, Signature> timestamps_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;
|
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.
|
// Transparently tidy match parameters, do map matching on tidied parameters.
|
||||||
// Then use the mapping to restore the original <-> tidied relationship.
|
// 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
|
// call the actual map matching
|
||||||
sub_matchings = algorithms.MapMatching(
|
sub_matchings = algorithms.MapMatching(candidates_lists,
|
||||||
candidates_lists,
|
tidied.parameters.coordinates,
|
||||||
tidied.parameters.coordinates,
|
tidied.parameters.timestamps,
|
||||||
tidied.parameters.timestamps,
|
tidied.parameters.radiuses,
|
||||||
tidied.parameters.radiuses,
|
parameters.gaps_processing ==
|
||||||
!(parameters.track_preprocessing == api::MatchParameters::PreprocessingType::False));
|
api::MatchParameters::GapsType::Split);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -222,12 +222,12 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call the actual map matching
|
// call the actual map matching
|
||||||
sub_matchings = algorithms.MapMatching(
|
sub_matchings = algorithms.MapMatching(candidates_lists,
|
||||||
candidates_lists,
|
parameters.coordinates,
|
||||||
parameters.coordinates,
|
parameters.timestamps,
|
||||||
parameters.timestamps,
|
parameters.radiuses,
|
||||||
parameters.radiuses,
|
parameters.gaps_processing ==
|
||||||
!(parameters.track_preprocessing == api::MatchParameters::PreprocessingType::False));
|
api::MatchParameters::GapsType::Split);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sub_matchings.size() == 0)
|
if (sub_matchings.size() == 0)
|
||||||
|
@ -55,7 +55,7 @@ mapMatchingImpl(SearchEngineData &engine_working_data,
|
|||||||
const std::vector<util::Coordinate> &trace_coordinates,
|
const std::vector<util::Coordinate> &trace_coordinates,
|
||||||
const std::vector<unsigned> &trace_timestamps,
|
const std::vector<unsigned> &trace_timestamps,
|
||||||
const std::vector<boost::optional<double>> &trace_gps_precision,
|
const std::vector<boost::optional<double>> &trace_gps_precision,
|
||||||
const bool use_tidying)
|
const bool allow_splitting)
|
||||||
{
|
{
|
||||||
map_matching::MatchingConfidence confidence;
|
map_matching::MatchingConfidence confidence;
|
||||||
map_matching::EmissionLogProbability default_emission_log_probability(DEFAULT_GPS_PRECISION);
|
map_matching::EmissionLogProbability default_emission_log_probability(DEFAULT_GPS_PRECISION);
|
||||||
@ -159,11 +159,7 @@ mapMatchingImpl(SearchEngineData &engine_working_data,
|
|||||||
|
|
||||||
const bool gap_in_trace = [&]() {
|
const bool gap_in_trace = [&]() {
|
||||||
// do not determine split if wasn't asked about it
|
// do not determine split if wasn't asked about it
|
||||||
if (!use_tidying)
|
if (allow_splitting)
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// use temporal information if available to determine a split
|
// use temporal information if available to determine a split
|
||||||
if (use_timestamps)
|
if (use_timestamps)
|
||||||
@ -176,6 +172,10 @@ mapMatchingImpl(SearchEngineData &engine_working_data,
|
|||||||
return t - prev_unbroken_timestamps.back() > MAX_BROKEN_STATES;
|
return t - prev_unbroken_timestamps.back() > MAX_BROKEN_STATES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
if (!gap_in_trace)
|
if (!gap_in_trace)
|
||||||
|
Loading…
Reference in New Issue
Block a user