Skip to content

Commit

Permalink
Merge branch 'web-demo' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cyang-kth committed Oct 28, 2020
2 parents 613c20b + edcc1de commit f164dac
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 24 deletions.
7 changes: 7 additions & 0 deletions example/web_demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data/*.cpg
data/*.dbf
data/*.shp
data/*.prj
data/*.shx
data/*.txt
data/*.bin
27 changes: 21 additions & 6 deletions example/web_demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,37 @@ Install with pip
pip install flask tornado
```

### Run the demo
### Download routable shapefile

Try to preprare real world routable road network file (e.g., network.shp or Stockholm.osm.pbf available at https://download.bbbike.org/osm/bbbike/Stockholm/).
Then update the json configuration below.
Download a routable network shapefile (with id, source, target fields)
from OSM using osmnx following the tutorial [osm map matching](https://github.com/cyang-kth/osm_mapmatching).

An example dataset is provided as [data.tar.gz](data/data.tar.gz).

```
# Extract the dataset
tar -xvf data/data.tar.gz -C data
```

### Run the fmm web demo

Run the fmm web demo
```bash
# Precompute UBODT file
ubodt_gen --network data/edges.shp --network_id fid --source u --target v \
--delta 0.03 -o data/ubodt.txt --use_omp
# Start the web app
python web_demo.py -c fmm_config.json
```

Run the stmatch web demo
### Run the stmatch web demo

```bash
# Start the web app
python web_demo.py -c stmatch_config.json
```

Visit `http://localhost:5000/demo` in your browser.

A practical tutorial is provided at [osm map matching](https://github.com/cyang-kth/osm_mapmatching).
You should be able to see

![demo](https://github.com/cyang-kth/fmm/blob/master/img/demo3.gif?raw=true)
Binary file added example/web_demo/data/data.tar.gz
Binary file not shown.
8 changes: 5 additions & 3 deletions example/web_demo/fmm_config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"input": {
"network": {
"file": "network.shp",
"id": "ID"
"file": "data/edges.shp",
"id": "fid",
"source": "u",
"target": "v"
},
"ubodt":{
"file": "ubodt.txt"
"file": "data/ubodt.txt"
}
},
"model": "fmm",
Expand Down
6 changes: 4 additions & 2 deletions example/web_demo/stmatch_config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"input": {
"network": {
"file": "network.shp",
"id": "ID"
"file": "data/edges.shp",
"id": "fid",
"source": "u",
"target": "v"
}
},
"model": "stmatch",
Expand Down
13 changes: 0 additions & 13 deletions example/web_demo/stmatch_config_osm.json

This file was deleted.

0 comments on commit f164dac

Please sign in to comment.