Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Tool to inspect matching generated by the road-network matching plugin in OSRM

License

Notifications You must be signed in to change notification settings

mapbox/osrm-matching-inspection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Matching inspection

These scripts can be used to inspect matchings generated by the map matching plugin for OSRM.

Installation

There are two ways to install the server side component. One involves building osrm-backend and node-osrm from source and one needs binary packges of a special node-osrm version.

From binary package

npm install osrm

Which downloads a binary package if it is available on your platform.

From source

Compile OSRM with debug support:

git clone https://github.com/Project-OSRM/osrm-backend.git
cd osrm-backend
mkdir -p build
cd build
cmake -DENABLE_JSON_LOGGING=1 .. 
make && sudo make install

Run:

npm install osrm --build-from-source

To download and compile node-osrm from source.

Client side components

Run:

bower install && make

To install the front-end components.

Importing traces

To import traces in GPX or CSV format contained in a folder data to the labeling database run:

node bin/server.js data

This will create a file data/clasification_db.sqlite which will contain a list of all traces and their classification.

Starting the frontend

Assuming your GPX traces are contained in a folder data in the current repository root:

Locally run:

node bin/server.js data path/to/dataset.osrm

Alternatively if you want to use osrm-routed instead of node-osrm just run:

node bin/server.js data

Which expects a osrm-routed server listening on https://127.0.0.1:5000.

Now you can view the frontend on https://127.0.0.1:8337 in your browser. It will look somewhat like this:

Which shows an interactive trellis diagram of the matching. Select a state pair to view the transition probabilities and Viterbi values.

You can use the left and right arrow key to cycle through the traces.

Classification

Opening https://127.0.0.1:8337/classify.html will display a minimal interface for easy classification. Pressing 0 will classify as unknown, 1 as valid and 2 as invalid.

The labels will be saved in classification_db.sqlite which can be used by bin/test_classification.js to verify the classifier implemented inside the OSRM plugin. bin/test_classification.js will also generate tested_db.json which is needed by bin/calibrate_classification.py to derive better classification values.

Batch matching

You can batch match a dataset using bin/traces2geojson.js data > matched.geojson which produces a geojson file containg the following features:

For every sub-matchings:

{
        "type": "Feature",
        "geometry": {
            "type": "LineString",
            "coordinates": [[lon, lat], ...],
        },
        "properties": {
            "type": "matching"
            file: "path/to/file"
            confidence: 0.5 # in [0, 1] -> 1 means very confident, 0 means no confidence
        }
}

For every trace fragment:

{
        "type": "Feature",
        "geometry": {
            "type": "LineString",
            "coordinates": [[lon, lat], ...],
        },
        "properties": {
            "type": "trace"
            file: "path/to/file"
            confidence: 0.5 # confidence of the corresponding sub-trace
        }
}

About

Tool to inspect matching generated by the road-network matching plugin in OSRM

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •