package mapmatching
Provides building blocks for implementing customizable map matchers.
See also com.here.platform.location.core.mapmatching.HMMPathMatcher.
- Alphabetic
- By Inheritance
- mapmatching
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
CandidateGenerator[O, V] extends AnyRef
Generates candidate
MatchResult
s for a particular observation.Generates candidate
MatchResult
s for a particular observation.See also HMMPathMatcher.
- O
The observation type
- V
The type of the elements for OnRoad matching
-
class
DirectDistanceCalculator[O, V, E, T] extends DistanceAndTransitionsCalculator[O, V, Seq[V]]
Calculates the distance between positions by following the road network, but only up to a directly connected vertex.
Calculates the distance between positions by following the road network, but only up to a directly connected vertex.
- The distance between positions on the same vertex that are ordered in the same direction as the vertex is their distance along that vertex.
- The distance between a position on vertex A and a position on a directly connected vertex B is the total length of the parts of A and B that you would have to traverse to get from one position into the other.
- The distance between two points on vertices that are not directly connected is
Double.PositiveInfinity
.
DirectDistanceCalculator also returns a transition for each calculated distance. The transition is the sequence of intermediate vertices that have to be traversed fully to get from one point to the other (excluding start vertex and end vertex).
- If both positions are on the same vertex or on directly connected vertices, the transition is an empty sequence of vertices because there are no intermediate vertices to traverse.
- Otherwise, the transition is
None
because the connectivity between the two points was not determined.
- O
The observation type
- V
The
graph
vertex type- E
The
graph
edge type- T
The transition type
-
trait
DistanceAndTransitionsCalculator[-O, V, T] extends AnyRef
Calculates distances and (optionally) transitions from a current position associated to a current observation, and to several next positions associated to the next observation.
Calculates distances and (optionally) transitions from a current position associated to a current observation, and to several next positions associated to the next observation.
It is required by DistanceTransitionProbabilityStrategy.
- O
The observation type
- V
The vertex type
- T
The transition type
- Annotations
- @FunctionalInterface()
-
class
DistanceEmissionProbabilityStrategy[O, V] extends EmissionProbabilityStrategy[O, V]
Computes emission probabilities for candidates based on distance.
Computes emission probabilities for candidates based on distance. A java.lang.UnsupportedOperationException is thrown for OffRoad.
See also com.here.platform.location.core.mapmatching.GaussianProbabilityDistribution.
-
class
DistanceFilter[O] extends Filter[O]
Filters out observations from a trip that are closer than
minDistance
to the most recent retained point.This is an experimental API. It may be removed or changed from one version to the next.
Filters out observations from a trip that are closer than
minDistance
to the most recent retained point.For example, consider the observations P1, P2 and P3 with the following distances between them:
- 2 meters from P1 to P2
- 4 meters from P1 to P3
- 2 meters from P2 to P3
Applying a DistanceFilter with a
minDistance
of 3 meters to these observations filters out P2. So the result isSeq(Retain(P1), Omit(P2), Retain(P3))
.- O
The observation type
- Annotations
- @Experimental()
-
class
DistanceTransitionProbabilityStrategy[O, V, T] extends TransitionProbabilityStrategyBase[O, V, T]
Calculates transition probability values based on the length of the route between projected points.
Calculates transition probability values based on the length of the route between projected points.
Specifically, it calculates the straight-line distance between observations and the length of the shortest route connecting each pair of projected points, then calculates the difference between these values and turns it into log(probability) values with
probabilityDistribution
.- O
The observation type
-
trait
EmissionProbabilityStrategy[O, V] extends AnyRef
Computes emission probabilities for candidates associated with an observation.
-
class
ExponentialProbabilityDistribution extends ProbabilityDistribution
Exponential distribution.
Exponential distribution.
See also Exponential_distribution.
-
trait
Filter[O] extends AnyRef
Marks each observation in a trip either as to be Omited, or to be Retained.
This is an experimental API. It may be removed or changed from one version to the next.
Marks each observation in a trip either as to be Omited, or to be Retained.
See also
- DistanceFilter for an implementation of Filter using distance.
- PathMatcherWithFilter that uses a Filter.
- Annotations
- @Experimental()
-
sealed
trait
FilteredObservation[O] extends AnyRef
The result of applying a Filter to an observation.
This is an experimental API. It may be removed or changed from one version to the next.
The result of applying a Filter to an observation. A Filter marks each observation in a trip either as to be Omited, or to be Retained.
- Annotations
- @Experimental()
-
class
GaussianProbabilityDistribution extends ProbabilityDistribution
Gaussian, or normal, probability distribution.
Gaussian, or normal, probability distribution.
See also Normal_distribution.
-
class
HMMPathMatcher[O, V, T] extends PathMatcher[O, V, T]
An implementation of
PathMatcher
that creates a Hidden Markov Model (HMM) and calculates the most likely path using the Viterbi algorithm.An implementation of
PathMatcher
that creates a Hidden Markov Model (HMM) and calculates the most likely path using the Viterbi algorithm.An instance of
HMMPathMatcher
delegates the creation of the following HMM components:- The
candidateGenerator
object creates candidate states.
Candidate states are possible MatchResults for a given observation of typeO
. Typically, a candidate state is the projection of an observation onto a nearby vertex of typeV
. - The
emissionProbabilityStrategy
object calculates the emission probabilities.
The emission probability represents the probability that an observation is emitted supposing that the system is in a given candidate state. - The
transitionProbabilityStrategy
object calculates the transition probabilities. Depending on the implementation, this object may return additional information of typeT
about the transitions.
Given two successive observations O1 and O2, a candidate state C1 generated for O1 and a candidate state C2 generated for O2, the transition probability between C1 and C2 represents the probability of the system going from state C1 to state C2.
See also Hidden Markov Map Matching Through Noise and Sparseness.
- The
-
trait
Interpolator[O, V, T] extends AnyRef
An Interpolator inserts MatchResults into the provided MatchedPath.results, one for each observation that was marked as Omitted.
This is an experimental API. It may be removed or changed from one version to the next.
An Interpolator inserts MatchResults into the provided MatchedPath.results, one for each observation that was marked as Omitted. It also updates MatchedPath.transitions accordingly. This does not modify the original MatchedPath.
- If you are interested in positions on the path for the interpolated results, use
ProjectingInterpolator, which creates OnRoad results. The
matchedPath
must contain transitions for ProjectingInterpolator to work. - If you are not interested in interpolated positions, use ToUnknownInterpolator. It inserts an Unknown for each observation that was marked as Omitted.
See also PathMatcherWithFilter for more information about filtering and interpolation.
- Annotations
- @Experimental()
- If you are interested in positions on the path for the interpolated results, use
ProjectingInterpolator, which creates OnRoad results. The
-
final
case class
LogProbability(value: Double) extends AnyVal with Product with Serializable
Logarithmic probability used in HMM computations.
Logarithmic probability used in HMM computations.
All probabilities are stored and computed using their log value to produce more stable and accurate results.
-
class
LogProbabilityMatrix extends AnyRef
A Matrix of LogProbability values.
A Matrix of LogProbability values.
Internally, the probabilities are stored in an
IndexedSeq[LogProbabilitySeq]
, oneLogProbabilitySeq
for each row of the matrix. -
trait
LogProbabilitySeq extends AnyRef
A Sequence of LogProbability values.
A Sequence of LogProbability values.
Internally, the probabilities are stored in an
Array[Double]
-
sealed
trait
MatchResult[+V] extends AnyRef
The result of matching an observation to a road network.
-
case class
MatchedPath[V, T](results: Seq[MatchResult[V]], transitions: Seq[Transition[T]]) extends Product with Serializable
The result of applying a PathMatcher to observations.
The result of applying a PathMatcher to observations.
See also TransitionProbabilityStrategy, which may compute transition data.
- V
The type of the elements for OnRoad results
- T
The type of transition data
- results
The MatchResult for each observation. The results will always have the same length as the input trace, and each element will correspond one to one with an input point in the same order. The type of result will indicate if the point was matched
OnRoad
or not.- transitions
The Transitions between results if they were computed during matching. When computed the transitions will contain the information to reconstruct a path connecting results together.
- Some results may not be connected to transitions, meaning there may be no
Transition
going
from
orto
that result. For example, a path containing an Unknown result could contain transitions that skip this result. That way, the transitions give a consistent picture of the path traveled while ignoring the Unknown, likely caused by incorrect data. - For any transition
t
,t.from
must be less thant.to
. - For two consecutive transitions
t1
andt2
,t1.to
must be less than or equal tot2.from
(the transitions must be sorted in ascending order)
- Some results may not be connected to transitions, meaning there may be no
Transition
going
-
abstract final
class
NoTransition extends AnyRef
A type that indicates that no transitions are returned from the corresponding path matcher.
-
final
case class
Omit[O](value: O) extends FilteredObservation[O] with Product with Serializable
The value was filtered out.
This is an experimental API. It may be removed or changed from one version to the next.
The value was filtered out.
- Annotations
- @Experimental()
-
case class
OnRoad[V](elementProjection: ElementProjection[V]) extends MatchResult[V] with Product with Serializable
Represents a successful match to an element of type
V
. -
trait
PathMatcher[O, V, T] extends AnyRef
A path-based map matcher.
A path-based map matcher.
- O
The observation type
- V
The type of the elements for OnRoad results
- T
The type of transitions computed during matching, if any, and returned as part of the MatchedPath.
-
class
PathMatcherWithFilter[O, V, T] extends PathMatcher[O, V, T]
A PathMatcher that filters observations, map matches the remaining observations using the
inner
PathMatcher, and interpolates a MatchResult for each observation previously filtered out.This is an experimental API. It may be removed or changed from one version to the next.
A PathMatcher that filters observations, map matches the remaining observations using the
inner
PathMatcher, and interpolates a MatchResult for each observation previously filtered out. The Interpolator also adapts the MatchedPath#transitions accordingly.Filtering is especially useful when the positions of observations are close to one another. This can happen when, for example, a car is slowly moving in a straight line, recording its position every second. Because of GPS noise, these observations can give the impression that the car was moving back and forth. Handling such a trip directly in a PathMatcher can be challenging. Instead, it is simpler to use a Filter in order to remove the observations that are responsible for this misleading impression.
Internally, PathMatcherWithFilter uses a Filter to mark each observation as either to be Omitted or to be Retained. It then collects the Retained observations and passes them to the
inner
PathMatcher for map matching. Last, it uses the Interpolator to process the resulting MatchedPath and create a new MatchedPath. This new MatchedPath contains an interpolated MatchResult for each observation previously filtered out and MatchedPath.transitions adapted to the new MatchedPath.results.- Annotations
- @Experimental()
-
trait
ProbabilityDistribution extends Serializable
Defines the probability distribution for a continuous random variable.
-
class
ProjectingInterpolator[O, V, LS] extends Interpolator[O, V, Seq[V]]
An Interpolator that tries to insert an OnRoad result for each Omitted observation by projecting the observation onto the
matchedPath
.This is an experimental API. It may be removed or changed from one version to the next.
An Interpolator that tries to insert an OnRoad result for each Omitted observation by projecting the observation onto the
matchedPath
.If a transition connects two OnRoad results for Retained observations, then any Omitted observation that occurred between these observations is covered by this transition and is interpolated to an OnRoad.
The Interpolator inserts an Unknown for each Omitted observation that is not covered by such a transition between OnRoads.
It also ensures that the interpolated OnRoad results are in order along the
matchedPath
.- Annotations
- @Experimental()
-
class
ProximitySearchCandidateGenerator[O, V] extends CandidateGenerator[O, V]
Generates candidate
State
s for an observation by proximity search.Generates candidate
State
s for an observation by proximity search.- O
The type of an observation
- V
The type of the elements for OnRoad matching
-
final
case class
Retain[O](value: O) extends FilteredObservation[O] with Product with Serializable
The value successfully passed the filter.
This is an experimental API. It may be removed or changed from one version to the next.
The value successfully passed the filter.
- Annotations
- @Experimental()
-
trait
SupportForUnknown[O, V] extends CandidateGenerator[O, V]
Adds an Unknown to the list of generated candidates.
-
class
ToUnknownInterpolator[O, V, T] extends Interpolator[O, V, T]
An Interpolator that inserts an Unknown for each observation that was marked to be Omitted.
This is an experimental API. It may be removed or changed from one version to the next.
An Interpolator that inserts an Unknown for each observation that was marked to be Omitted. It updates only the indices of transitions contained in
matchedPath
but does not add or remove transitions.If you want to use PathMatcherWithFilter but don't need the MatchResults for points that were filtered out, use ToUnknownInterpolator.
This Interpolator is faster than ProjectingInterpolator. The latter provides OnRoad results.
- Annotations
- @Experimental()
-
trait
TransitionProbabilityStrategy[O, V, T] extends AnyRef
Computes the transition probabilities and (optionally) additional transition data.
-
class
SimpleConnectivityTransitionProbabilityStrategy[O, V, E] extends TransitionProbabilityStrategyBase[O, V, NoTransition]
A simplistic implementation to compute transition probabilities for dense probe points.
A simplistic implementation to compute transition probabilities for dense probe points.
Computes a transition probability by classifying the connectivity between road segments using a topology graph. Each case is associated with a constant value for the transition probability.
This class distinguishes three cases:
- SameVertex: The two segments are the same
- Neighboring: The two segments are directly connected
- Distant/Disconnected: The two segments are not directly connected
- Annotations
- @Deprecated @deprecated
- Deprecated
(Since version SDK 2.48) Please use DistanceTransitionProbabilityStrategy
- Note
Although it produces reasonable results when the map data and the probe data are of high quality, this is not meant for implementing a general purpose map matcher.
Value Members
- object CandidateGenerators
- object DistanceEmissionProbabilityStrategy
- object DistanceTransitionProbabilityStrategy
- object ExponentialProbabilityDistribution extends Serializable
- object LogProbabilityMatrix
- object LogProbabilitySeq
- object MatchedPath extends Serializable
-
object
OffRoad extends MatchResult[Nothing] with Product with Serializable
Represents an "off-road" where a path matcher decides that the corresponding observation occurred outside of the road network.
Represents an "off-road" where a path matcher decides that the corresponding observation occurred outside of the road network.
A few examples might be moving on parking lots, or driving off-track.
- object ProximitySearchCandidateGenerator
-
object
Solver
Finds the most likely path through a Map-Matching specific Hidden Markov Model.
Finds the most likely path through a Map-Matching specific Hidden Markov Model.
The solver finds the most probable sequence of states, given the provided states and transitions without filtering states or transitions.
- Note
In case of numerical difficulties the solution is undefined.
-
object
Unknown extends MatchResult[Nothing] with Product with Serializable
Represents a result when the path matcher fails to match an observation.
Represents a result when the path matcher fails to match an observation.
This might happen in case of observation outliers.
Deprecated Value Members
-
object
SimpleConnectivityTransitionProbabilityStrategy
- Annotations
- @deprecated
- Deprecated
(Since version 2.48) Please use DistanceTransitionProbabilityStrategy