Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mapbox/osrm-matching-inspection

Tool to inspect matching generated by the road-network matching plugin in OSRM
https://github.com/mapbox/osrm-matching-inspection

banished

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# Matching inspection

These scripts can be used to inspect matchings generated by the [map matching](https://github.com/Project-OSRM/osrm-backend/tree/feature/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 ```http://127.0.0.1:5000```.

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

![](http://i.imgur.com/XvMjiVC.png)

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 ```http://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:
```js
{
"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:
```js
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [[lon, lat], ...],
},
"properties": {
"type": "trace"
file: "path/to/file"
confidence: 0.5 # confidence of the corresponding sub-trace
}
}
```