Utils
Helper functions and classes.
Modules
For readability, the full path is listed below and not used in other parts of the documentation.
mappymatch.utils.exceptionsmappymatch.utils.geomappymatch.utils.plotmappymatch.utils.tracemappymatch.utils.url
exceptions module
geo module
- coord_to_coord_dist(a: Coordinate, b: Coordinate) float[source]
Compute the distance between two coordinates.
- Parameters:
a – The first coordinate
b – The second coordinate
- Returns:
The distance in meters
plot module
- plot_geofence(geofence: Geofence, m: Map | None = None)[source]
Plot geofence.
- Parameters:
geofence – The geofence to plot
m – the folium map to plot on
- Returns:
The updated folium map with the geofence.
- plot_map(tmap: NxMap, m: Map | None = None)[source]
Plot the roads on an NxMap.
- Parameters:
tmap – The Nxmap to plot.
m – the folium map to add to
- Returns:
The folium map with the roads plotted.
- plot_match_distances(matches: MatchResult)[source]
Plot the points deviance from known roads with matplotlib.
- Parameters:
matches (MatchResult) – The coordinates of guessed points in the area in the form of a MatchResult object.
- 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.
- 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.
- Parameters:
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.
- plot_trace(trace: Trace, m: Map | None = None, point_color: str = 'black', line_color: str | None = 'green')[source]
Plot a trace.
- Parameters:
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.