mappymatch.matchers.lcss.constructs#

Classes

CuttingPoint(trace_index)

A cutting point represents where the LCSS algorithm cuts the trace into a sub-segment.

TrajectorySegment(trace, path[, matches, ...])

Represents a pairing of a trace and candidate path

class mappymatch.matchers.lcss.constructs.CuttingPoint(trace_index: signedinteger | int)[source]#

A cutting point represents where the LCSS algorithm cuts the trace into a sub-segment.

Attributes:

trace_index: An index of where to cut the trace

Parameters:

trace_index (signedinteger | int)

trace_index: Union[signedinteger, int]#

Alias for field number 0

class mappymatch.matchers.lcss.constructs.TrajectorySegment(trace: Trace, path: List[Road], matches: List[Match] = [], score: float = 0, cutting_points: List[CuttingPoint] = [])[source]#

Represents a pairing of a trace and candidate path

Attributes:

trace: The trace in the segment path: The candidate path in the segment matches: The matches between the trace and the path score: The similarity score between the trace and the path cutting_points: The points where the trace and path are to be cut

Parameters:
trace: Trace#

Alias for field number 0

path: List[Road]#

Alias for field number 1

matches: List[Match]#

Alias for field number 2

score: float#

Alias for field number 3

cutting_points: List[CuttingPoint]#

Alias for field number 4

set_score(score)[source]#

Sets the score of the trajectory segment

Return type:

TrajectorySegment

Parameters:

score (float)

Args:

score: The score of the trajectory segment

Returns:

The updated trajectory segment

set_cutting_points(cutting_points)[source]#

Sets the cutting points of the trajectory segment

Return type:

TrajectorySegment

Args:

cutting_points: The cutting points of the trajectory segment

Returns:

The updated trajectory segment

set_matches(matches)[source]#

Sets the matches of the trajectory segment

Return type:

TrajectorySegment

Args:

matches: The matches of the trajectory segment

Returns:

The updated trajectory segment

score_and_match(distance_epsilon, max_distance)[source]#

Computes the score of a trace, pair matching and also matches the coordinates to the nearest road.

Return type:

TrajectorySegment

Parameters:
  • distance_epsilon (float)

  • max_distance (float)

Args:

distance_epsilon: The distance threshold for matching max_distance: The maximum distance between the trace and the path

Returns:

The updated trajectory segment with a score and matches

compute_cutting_points(distance_epsilon, cutting_thresh, random_cuts)[source]#
Return type:

TrajectorySegment

Parameters:
  • distance_epsilon (float)

  • cutting_thresh (float)

  • random_cuts (int)

Computes the cutting points for a trajectory segment by:
  • computing the furthest point

  • adding points that are close to the distance epsilon

Args:

distance_epsilon: The distance threshold for matching cutting_thresh: The threshold for cutting the trace random_cuts: The number of random cuts to add

Returns:

The updated trajectory segment with cutting points