osrm-backend/traffic_updater
Xun(Perry) Liu a3eb24a0fc Feature/optimize traffic convertor (#41)
* feat: Optimize output of wayid2nodeids format, use delta format to comparess data

Issues: https://github.com/Telenav/osrm-backend/issues/31

* feat: Implement logic to compress/decompress file to snappy.

issues: https://github.com/Telenav/osrm-backend/issues/31

* feat: Modify osrm speed table generator to support snappy compression format.

issues: https://github.com/Telenav/osrm-backend/issues/31

* feat: Fix bug during conversion

* feat: Adjust traffic updater's logic to improve performance.

* feat: Adjust traffic updater's logic to improve performance.

issues: https://github.com/Telenav/osrm-backend/pull/39

* feat: Refine the code for osrm_traffic_updater.

issues: https://github.com/Telenav/osrm-backend/issues/31

* fix: fix dead lock in the code.

* fix: optimize performance with new architecture.
issues: https://github.com/Telenav/osrm-backend/issues/31

* fix: revert way id generator to original solution

* fix: Use string to pass between different components
issues: https://github.com/Telenav/osrm-backend/issues/31

* fix: update unit test for latest changes
issues: https://github.com/Telenav/osrm-backend/issues/31

* fix: remove useless printf

* fix: update unit test for osrm_traffic_updater.go

* fix: fix the misunderstanding with requirement.  Traffic server generates -wayid indicate for traffic flow on reverse direction.
issues: https://github.com/Telenav/osrm-backend/issues/31
2019-07-17 09:11:38 +08:00
..
go Feature/optimize traffic convertor (#41) 2019-07-17 09:11:38 +08:00
.gitignore Integrate Telenav Traffic Design and traffic_updater implementation (#18) 2019-06-17 13:50:31 -07:00
proxy.thrift Update proxy thrift RPC protocol (#29) 2019-06-26 11:29:58 -07:00
README.md feat: Implement logic to generate way-2-nodes mapping and convert traffic result to nodes-2-speed (#28) 2019-06-28 11:10:54 +08:00

OSRM Traffic Updater

The OSRM Traffic Updater is designed for pull traffic data from Traffic Proxy(Telenav) then dump to OSRM required traffic.csv. Refer to OSRM with Telenav Traffic Design and OSRM Traffic for more details.
We have implemented both Python and Go version. Both of them have same function(pull data then dump to csv), but the Go implementation is about 23 times faster than Python implementation. So strongly recommended to use Go implementation as preference.

  • E.g. 6727490 lines traffic of NA region
    • Go Implementation: about 9 seconds
    • Python Implementation: about 210 seconds

RPC Protocol

See proxy.thrift for details.

Python Implementation

The python based implementation has been deprecated due to bad performance. See Deprecated Python Implementation Codes if you'd like to see code details.

Go Implementation

Requirements

  • go version go1.12.5 linux/amd64
  • thrift 0.12.0
    • clone thrift from github.com/apache/thrift, then checkout branch 0.12.0
  • change thrift imports in generated codes gen-go/proxy
    • git.apache.org/thrift.git/lib/go/thrift -> github.com/apache/thrift/lib/go/thrift

Usage

$ cd $GOPATH
$ go install github.com/Telenav/osrm-backend/traffic_updater/go/osrm_traffic_updater
$ ./bin/osrm_traffic_updater -h
Usage of ./bin/osrm_traffic_updater:
  -c string
    	traffic proxy ip address (default "127.0.0.1")
  -d	use high precision speeds, i.e. decimal. (default false)
  -f string
    	OSRM traffic csv file (default "traffic.csv")
  -m string
    	OSRM way id to node ids mapping table (default "wayid2nodeids.csv")
  -p int
    	traffic proxy listening port (default 6666)

wayid2nodeids_extractor

Extract wayid to nodeids mapping from PBF

Usage

$ cd $GOPATH
$ go install github.com/Telenav/osrm-backend/traffic_updater/go/wayid2nodeid_extractor
$ ./bin/wayid2nodeid_extractor -h
Usage of ./bin/wayid2nodeid_extractor:
  -b	Is pbf generated by telenav internally
  -i string
    	Input pbf file.
  -o string
    	Output csv file