mappymatch.utils.plot#

Plot module for mappymatch.

This module provides plotting utilities for geofences, traces, matches, maps, paths, and trajectory segments.

mappymatch.utils.plot.plot_geofence(geofence: Geofence, m: Map | None = None)[source]#

Plot geofence.

Args:

geofence: The geofence to plot m: the folium map to plot on

Returns:

The updated folium map with the geofence.

mappymatch.utils.plot.plot_trace(trace: Trace, m: Map | None = None, point_color: str = 'black', line_color: str | None = 'green')[source]#

Plot a trace.

Args:

trace: The trace. m: the folium map to plot on point_color: The color the points will be plotted in. line_color: The color for lines. If None, no lines will be plotted.

Returns:

An updated folium map with a plot of trace.

mappymatch.utils.plot.plot_matches(matches: ~mappymatch.matchers.match_result.MatchResult | ~typing.List[~mappymatch.constructs.match.Match], crs=<Projected CRS: EPSG:3857> Name: WGS 84 / Pseudo-Mercator Axis Info [cartesian]: - X[east]: Easting (metre) - Y[north]: Northing (metre) Area of Use: - name: World between 85.06°S and 85.06°N. - bounds: (-180.0, -85.06, 180.0, 85.06) Coordinate Operation: - name: Popular Visualisation Pseudo-Mercator - method: Popular Visualisation Pseudo Mercator Datum: World Geodetic System 1984 ensemble - Ellipsoid: WGS 84 - Prime Meridian: Greenwich )[source]#

Plots a trace and the relevant matches on a folium map.

Args: matches: A list of matches or a MatchResult. crs: what crs to plot in. Defaults to XY_CRS.

Returns:

A folium map with trace and matches plotted.

mappymatch.utils.plot.plot_match_distances(matches: MatchResult)[source]#

Plot the points deviance from known roads with matplotlib.

Args:

matches (MatchResult): The coordinates of guessed points in the area in the form of a MatchResult object.

mappymatch.utils.plot.plot_map(tmap: NxMap, m: Map | None = None, highlight: bool = False)[source]#

Plot the roads on an NxMap.

Args:

tmap: The Nxmap to plot. m: the folium map to add to highlight: Whether to enable hover highlighting and popups (default: False)

Returns:

The folium map with the roads plotted.

mappymatch.utils.plot.plot_path(path: List[Road], crs: CRS, m: Map | None = None, line_color='red', line_weight=10, line_opacity=0.8)[source]#

Plot a list of roads.

Args:

path: The path to plot. crs: The crs of the path. m: The folium map to add to. line_color: The color of the line. line_weight: The weight of the line. line_opacity: The opacity of the line.

mappymatch.utils.plot.plot_trajectory_segment(segment: TrajectorySegment, m: Map | None = None, trace_point_color: str = 'black', path_line_color: str = 'red', path_line_weight: int = 10, path_line_opacity: float = 0.8, show_matches: bool = True, match_point_color: str = 'blue', show_cutting_points: bool = True, cutting_point_color: str = 'orange')[source]#

Plot a TrajectorySegment showing the trace, path, matches, and cutting points.

Args:

segment: The TrajectorySegment to plot. m: The folium map to plot on. If None, a new map will be created. trace_point_color: The color for trace points. path_line_color: The color for the path line. path_line_weight: The weight of the path line. path_line_opacity: The opacity of the path line. show_matches: Whether to show matched points. match_point_color: The color for matched points. show_cutting_points: Whether to show cutting points. cutting_point_color: The color for cutting points.

Returns:

A folium map with the trajectory segment plotted.

Modules