Skip to main content

Package for mapmatching.

Project description

mappymatch

Mappymatch is a pure-python package developed and open sourced by the National Renewable Energy Laboratory. It contains a collection of "Matchers" that enable matching a GPS trace (series of GPS coordinates) to a map.

Map Matching Animation

The current matchers are:

  • LCSSMatcher: A matcher that implements the LCSS algorithm described in this paper. Works best with high resolution GPS traces.
  • OsrmMatcher: A light matcher that pings an OSRM server to request map matching results. See the official documentation for more info.
  • ValhallaMatcher: A matcher to ping a Valhalla server for map matching results.

Currently supported map formats are:

  • Open Street Maps

Installation

pip install mappymatch

If you have trouble with that, check out the docs for more detailed install instructions.

Example Usage

The current primary workflow is to use osmnx to download a road network and match it using the LCSSMatcher.

The LCSSMatcher implements the map matching algorithm described in this paper:

Zhu, Lei, Jacob R. Holden, and Jeffrey D. Gonder. "Trajectory Segmentation Map-Matching Approach for Large-Scale, High-Resolution GPS Data." Transportation Research Record: Journal of the Transportation Research Board 2645 (2017): 67-75.

usage:

from mappymatch import package_root
from mappymatch.constructs.geofence import Geofence
from mappymatch.constructs.trace import Trace
from mappymatch.maps.nx.nx_map import NxMap
from mappymatch.matchers.lcss.lcss import LCSSMatcher

trace = Trace.from_csv(package_root() / "resources/traces/sample_trace_1.csv")

# generate a geofence polygon that surrounds the trace; units are in meters;
# this is used to query OSM for a small map that we can match to
geofence = Geofence.from_trace(trace, padding=1e3)

# uses osmnx to pull a networkx map from the OSM database
nx_map = NxMap.from_geofence(geofence)

matcher = LCSSMatcher(nx_map)

matches = matcher.match_trace(trace)

# convert the matches to a dataframe
df = matches.matches_to_dataframe()

Example Notebooks

Example JupyterLab notebooks making use of mappymatch can be found in the mappymatch examples repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mappymatch-0.5.0.tar.gz (53.4 kB view details)

Uploaded Source

Built Distribution

mappymatch-0.5.0-py3-none-any.whl (53.8 kB view details)

Uploaded Python 3

File details

Details for the file mappymatch-0.5.0.tar.gz.

File metadata

  • Download URL: mappymatch-0.5.0.tar.gz
  • Upload date:
  • Size: 53.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mappymatch-0.5.0.tar.gz
Algorithm Hash digest
SHA256 1152537fedaee78f8c3b603da7d3aef5790edc1a574bb1db508958067332e3f1
MD5 6002b60f9960641b3d924fc85953ed13
BLAKE2b-256 8b97dfb4fc4d6590d92867c45b55296aef33707be2f0a49be9a89febdc59906f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mappymatch-0.5.0.tar.gz:

Publisher: release.yaml on NREL/mappymatch

Attestations:

File details

Details for the file mappymatch-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: mappymatch-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 53.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mappymatch-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 581b0d581dc45f8a538bf1823225c2f9fa6c38bae6d56b413e0d0cb7201e4210
MD5 375208ebaaf8d894dee891c1c198fc1c
BLAKE2b-256 a95c7cc25963a735cae9a8dabe9e2959b236b279d76f99ff1595d96268c10992

See more details on using hashes here.

Provenance

The following attestation bundles were made for mappymatch-0.5.0-py3-none-any.whl:

Publisher: release.yaml on NREL/mappymatch

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page