{"id":17177816,"url":"https://github.com/categulario/map_matching","last_synced_at":"2025-04-13T16:21:46.547Z","repository":{"id":141783827,"uuid":"91201785","full_name":"categulario/map_matching","owner":"categulario","description":"Algorithms to find the streets that a vehicle should have traveled to generate a given GPS track","archived":false,"fork":false,"pushed_at":"2022-09-22T19:02:41.000Z","size":1074,"stargazers_count":60,"open_issues_count":5,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T07:11:52.527Z","etag":null,"topics":["algorithm","map-matching","redis","street"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/categulario.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-13T20:45:52.000Z","updated_at":"2025-03-06T10:30:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"1a2dddc9-f23e-4aa5-84f0-311e1d48e206","html_url":"https://github.com/categulario/map_matching","commit_stats":{"total_commits":110,"total_committers":6,"mean_commits":"18.333333333333332","dds":0.4818181818181818,"last_synced_commit":"745d23dfa30515ec5ea4a43d7a89044dba2db588"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/categulario%2Fmap_matching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/categulario%2Fmap_matching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/categulario%2Fmap_matching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/categulario%2Fmap_matching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/categulario","download_url":"https://codeload.github.com/categulario/map_matching/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741846,"owners_count":21154386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","map-matching","redis","street"],"created_at":"2024-10-15T00:05:13.707Z","updated_at":"2025-04-13T16:21:46.527Z","avatar_url":"https://github.com/categulario.png","language":"Python","readme":"Map-Matching Algorithm\n######################\n\n.. image:: https://badges.gitter.im/Join%20Chat.svg\n   :target: https://gitter.im/map_matching/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge\n   :alt: Gitter\n\n.. image:: https://img.shields.io/github/stars/categulario/map_matching.svg\n   :target: https://github.com/categulario/map_matching\n   :alt: GitHub stars\n\n.. image:: https://img.shields.io/github/contributors/categulario/map_matching.svg?color=red\n   :target: https://github.com/categulario/map_matching/graphs/contributors\n   :alt: GitHub contributors\n\n.. image:: https://img.shields.io/github/license/categulario/map_matching.svg?color=blue\n   :target: https://github.com/categulario/map_matching/blob/master/LICENSE.txt\n   :alt: GNU GPL v3\n\n.. image:: https://gitlab.com/categulario/map_matching/badges/master/pipeline.svg\n   :target: https://gitlab.com/categulario/map_matching/pipelines\n   :alt: Build Status\n\n**Im rewriting this in the Rust programming language: check the progress here:**\n\nhttps://gitlab.com/categulario/mapmatching-rs\n\nMy implementation of the map matching algorithm from `this article\n\u003chttps://www.researchgate.net/publication/308856380_Fast_Hidden_Markov_Model_Map-Matching_for_Sparse_and_Noisy_Trajectories\u003e`_\n(Althought with some modifications). The goal is to get the streets from a gps\ntrack.\n\nThis is how it looks like:\n\n.. image:: https://categulario.xyz/map_matching_result.png\n   :target: https://categulario.xyz/map_matching_result.png\n   :alt: Output of the example run\n\nThe gray line is the gps trace and the colored lines describe the map-matched\nmost-likely route in the streets for the vehicle.\n\nFor reference read\n`the resulting article \u003chttps://categulario.xyz/mapmatching.pdf\u003e`_.\n\nSetup\n-----\n\nYou'll need python 3.5+ and a redis server running. The usage of a virtual\nenvironment is recommended.\n\nInstall from pypi:\n\n.. code:: bash\n\n   $ pip install mapmatching\n\nOr install from source:\n\n.. code:: bash\n\n   $ cd mapmatching\n   $ python setup.py install\n\nCLI Usage\n---------\n\nDownload data from OpenStreetMaps:\n\n.. code:: bash\n\n   $ mapmatching download -h\n   $ mapmatching download -96.99107360839844 19.441181182861328 -96.846435546875 19.59616470336914 -o streets.json\n\nAnd load it to redis, by default it loads it to database 1 instead of redis\ndefault of 0.\n\n.. code:: bash\n\n   $ mapmatching load -f streets.json\n\nThe two previous commands can be chained:\n\n.. code:: bash\n\n   $ mapmatching download -96.99107360839844 19.441181182861328 -96.846435546875 19.59616470336914 | mapmatching load\n\nThen run the match task with a geojson file with a single gps track. A sample\ntrack that works with the sample bounding box is contained in the ``data/``\ndirectory of the repository.\n\n.. code:: bash\n\n   $ mapmatching match -h\n   $ mapmatching match data/route.geojson -o output.json\n\nOptionally visualize it in the browser:\n\n.. code:: bash\n\n   $ pip install geojsonio\n   $ geojsonio output.json\n\nif the output is too big you might need to copy+paste the contents of the\noutput file into http://geojson.io\n\nPython API\n----------\n\nYou can also import this as a module and use it in your python code. You'll\nstill need a running redis instance.\n\n.. code:: python\n\n   import json\n\n   from redis import Redis\n\n   from mapmatching.match import match\n   from mapmatching.lua import LuaManager\n   from mapmatching.data import download_from_overpass, load_to_redis\n\n   data = download_from_overpass(-96.99107360839844, 19.441181182861328, -96.846435546875, 19.59616470336914)\n\n   redis = Redis(host='localhost', port='6379', db=0)\n\n   load_to_redis(data, redis)\n\n   with open('data/route.geojson', 'r') as routefile:\n      route = json.load(routefile)\n\n   coordinates = route['features'][0]['geometry']['coordinates']\n\n   json_output = match(\n      redis,\n      LuaManager(redis),\n      coordinates,\n      10,  # How many points to process\n      50,  # Radius in meters to use in the search for close points\n   )\n\n   with open('output.json', 'w') as outputfile:\n      json.dump(json_output, outputfile, indent=2)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcategulario%2Fmap_matching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcategulario%2Fmap_matching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcategulario%2Fmap_matching/lists"}