Skip to main content

Fast Map Matching - High-performance map matching library

Project description

fastmm

fastmm is a fast (C++) map-matching library for python with no dependencies, and the ability to interpolate time on the match, not just position.

It's based on a desire to map match a lot of vehicle trace data quickly, without the infrastructure to spin up OSRM / Valhalla. (And this is probably faster as there's no IPC ... ?)

It is based on https://github.com/cyang-kth/fmm but updated to:

  • Remove GDAL/OGR dependencies - networks are created programmatically from Python
  • Include Python helper classes for automatic trajectory splitting and time interpolation
  • Be buildable on Windows/Linux/Mac with modern tooling
  • Focus on Python packaging with distributable wheels
  • Remove STMatch - we'll focus on FMM for now

Status:

  • Tested ... = )
  • MapMatcher helper class with auto-splitting and time interpolation
  • FASTMM algorithm working
  • Python API for network creation and matching
  • Windows, linux, and macOS wheel builds

Installation

pip install fastmm

TODO

  • Bring in extra python code.
  • Get test working in python.
  • If not found in UBODT, instead of bailing, do a normal djikstra lookup.
  • Need to check reverse tolerance - on our edges, they're all directed, so we probably shouldn't allow reversing. This causes errors when we're parsing - if you reverse on the same edge, the geometry gets flipped (I think - line = ALGORITHM::cutoffseg_unique(e0.geom, start_offset, end_offset); goes backward?), which then messes with our python post-processing of associating time as the segment start/stop are now the edge stop/start, not the other way round. We could add a reversed flag to the edge? That would help. For now, just don't have a reverse tolerance.
  • Could move the journey splitting (e.g. when unmatched candidate or points too far apart) into the C++ code here. Would be more optimal as a) C++, and b) don't need to repeat candidate lookup etc.
  • Improve serialization of UBODT to be cross-platform.
  • Specify versions for build libs (e.g. cibuildwheel).

Custom costs

To implement, just update the NetworkGraph construction, and set g[e].length = edge.cost (where you read edge in from the read_ogr_file etc.). The change transition probability to

// double tp = TransitionGraph::calculate_transition_probability(shortest_path_distance, euclidean_distance);
double tp = exp(-0.01 * shortest_path_distance); //

Seems to work:

  • set cost to 1 and it minimizes the number of edges
  • set cost to edge length, and gives similar result (as both the methods minimise distance - only differences is the previous method is using euclidean distance between candidates maybe, not matched points? would only matter with dense points).
  • can prevent some edges being used by manually bumping up their cost (tested on one road by cost *= 100 for those edges - worked, it avoided those edges).
  • Untested:
    • time based: if we have speed on all edges, set cost = distance / speed.
    • use road hierachy or similar - prioritise main highways. More useful for addinsight.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fastmm-0.1.0-cp312-cp312-win_amd64.whl (709.2 kB view details)

Uploaded CPython 3.12Windows x86-64

fastmm-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (653.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

fastmm-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (657.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fastmm-0.1.0-cp311-cp311-win_amd64.whl (708.5 kB view details)

Uploaded CPython 3.11Windows x86-64

fastmm-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (654.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

fastmm-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (657.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

fastmm-0.1.0-cp310-cp310-win_amd64.whl (707.8 kB view details)

Uploaded CPython 3.10Windows x86-64

fastmm-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl (652.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

fastmm-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (656.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

fastmm-0.1.0-cp39-cp39-win_amd64.whl (708.1 kB view details)

Uploaded CPython 3.9Windows x86-64

fastmm-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl (654.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

fastmm-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (656.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

fastmm-0.1.0-cp38-cp38-win_amd64.whl (718.1 kB view details)

Uploaded CPython 3.8Windows x86-64

fastmm-0.1.0-cp38-cp38-manylinux_2_28_x86_64.whl (653.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

fastmm-0.1.0-cp38-cp38-macosx_11_0_arm64.whl (655.9 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file fastmm-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fastmm-0.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 709.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastmm-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b90488bdcfedf9a78011fab149a74ca609282cdc46e0be8c5b21cfa8955f43f5
MD5 29f6a0693a6e6e57938be606bae681dd
BLAKE2b-256 34f06d11317521af310699dd9907b7bae6801bf8a942f5c221929c95dbdfab04

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a941f69ec55dfe1c961e9f7ab271e3e6cbda0edc173b6550a896323f5e989d17
MD5 d1d5788c9955eda9337b17501a8d30a9
BLAKE2b-256 e3c505e090e57400c77aeb3ff2114dd04c516b2a175c865bcc8608dbe66029bd

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bcc8a12d016acb45f19653154adc22ae5a755e3cbd67fa9a3fba71c5bd13d363
MD5 6d69d9df15d4af6d256ca13a5d4a09fd
BLAKE2b-256 a126587b4873b50d58d6d4407d1b90537623ddcb911a738ef1602a2033e99910

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: fastmm-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 708.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastmm-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bf54d5f86f1ed36dd4db7f00ffe46ec05bea3e619ccc4b9d6113387d9439188e
MD5 c60ff2749be9e8f929d2b84495a2b22b
BLAKE2b-256 e6b15b680d97dd96b4f17048248fcfeff846d5231185cbfdd4decabd6ff01f14

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eae6983a27b81c136b2706d46bdcde30c3a0b914a3b6504be0f9e7ccb5f648d6
MD5 60e50dc8d69aeb05e9724d233f028768
BLAKE2b-256 cfb86f1b7ce43606bf02bb7052da882d285ae514f87b0c7b12bd2294d9bb58fc

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1904c64ef91a3e4b5cad27ca869ec06cd88255871fc86549c75a96df275b7116
MD5 e5d38eed8bdf7fa8332b91728cbb53c3
BLAKE2b-256 89efefaca6d21127e5749627d5d1407b56357bd17286044292372057ac6b1d92

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: fastmm-0.1.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 707.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastmm-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8078d72230732c64b48a19d20f6aaf2dbcd67bf6e0c0ddd8332dc8144803f1bb
MD5 1b913bb97b2af63c995601973f20d24d
BLAKE2b-256 a233385d5b4514157739f8b9d470fab95875dd97acaf8afdc4ecd2ef4c4fbc3f

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fd36911ed318007754f37c95b865fbe8f097653813d657586c266046ba6e8e7c
MD5 95c0921ffab15bc58537e984705bfa8f
BLAKE2b-256 1a2adab834fcdcc3521bb2eb472648bdf89ea3e16e1912725ad6c23822eb5404

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eaa5c119cecfcfcd040e16769459fa636847f2428456271b81331185e329ea3d
MD5 73a5c953bce9497ae0ffde70af04e3bb
BLAKE2b-256 ef5a0fc84ef56948f7130ea3859c604377ecf5bb24ad33e3b661b6acce0c8141

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: fastmm-0.1.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 708.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastmm-0.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6828b50939e12aca47b4f6ab6c5935e41b225432acfedc79e4f303c57cc52487
MD5 c1c0f90371bf317e4d5afb3dcc22a0ca
BLAKE2b-256 d985f98d0c45f185d4f80c9b46f135e66019c650ee3ab9b1cc43c9978c65b35c

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d435dcc4613dd8ce030ca73d87b4a8d4e11b3c74f5eb5a8c253fedd1a0001e3d
MD5 a24ebffa0ae07be88f7fdc3cab79e3d2
BLAKE2b-256 2e8892a73ef8d038b7b1201eb28eae0cc25c254ab769a5eb497c7adc663dfe38

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 048558b7d5b83b4fc5ef75c2302a7dcc4b7cd3aae18969fe436e55f932e2a03f
MD5 dda704ae8d2459e8d79a2f1ea6fc695f
BLAKE2b-256 022387ffb019f41dba783f605109f3766444e9e07daa98f3f9ce5a4a64dad82a

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: fastmm-0.1.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 718.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastmm-0.1.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 dd147b1d99a0d88c377f381c57c4b11efc9f9ceb24a1b9aa67af9a3500184974
MD5 7333218a4ec623c85cf2cfcbb28d4445
BLAKE2b-256 baa1d8967d465192075905c8bdeb5a5be721e6e42f0fb73fdbb4713dc3fe5133

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 32596cb6f0c5fcf5060600f592307efcacf3ae301c43939e4330eb5fbb24cf4d
MD5 326027c69f3a9df44343712101d2d7be
BLAKE2b-256 35a2097735c9f436ecb9ae8e86bcc7dd71357152e58e540b2652b9e230620100

See more details on using hashes here.

File details

Details for the file fastmm-0.1.0-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastmm-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea8763237c2a440f0b6139472331ed94d9808acfa227ecb174e9bbaf5c88bcf0
MD5 03194c71f496a8338604ce5e25b79130
BLAKE2b-256 271b144d0b1ca94e3e19f432b300660a9e75b70c6bc27a1df9d5e97a134d393b

See more details on using hashes here.

Supported by

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