Road Traffic Example
Deployment
Assuming you have Java 8, Maven and Git installed, you can build and run the latest version of the road traffic demo by doing the following:
# Clone the Gaffer repository, to reduce the amount you need to download this will only clone the master branch with a depth of 1 so there won't be any history.
git clone --depth 1 --branch master https://github.com/gchq/Gaffer.git
cd Gaffer
# Run the start script. This will download several maven dependencies such as tomcat.
# If you have a snapshot version and want to build all dependencies first then add -am as a script argument
./example/road-traffic/scripts/start.sh
The rest api will be deployed to localhost:8080/rest.
The sample data used is taken from the Department for Transport GB Road Traffic Counts, which is licensed under the Open Government Licence.
This data contains information about UK roads, their locations and hourly traffic flow between adjacent road junctions.
We've modelled the road use data as a simple Gaffer graph to demonstrate how Gaffer lets users explore and summarise data.
There are edges representing:
- Region to Location: e.g South West - Bristol, South West - Devon etc.
- Location to Roads: e.g. Bristol - M32 etc
- Roads and their Junctions: e.g. M32 - M32:1, M32 - M32:2, etc.
- Junctions and their locations: e.g. M32:2 - 361150,175250, etc.
- Traffic counts between junctions during specific hours: e.g. M32:1 - M32:2 etc.
We can start with a UK region, such as the South West, and find the locations within that region. Then pick one or more of those locations, find the roads there and list their junctions. Then between any pair of adjacent junctions, we can summarise the vehicle counts over a time range of our choosing.
There will be multiple edges representing the traffic counts between the same two junctions: one for each hour of observation recorded in the data. Each of the RoadUse edges has properties attached to it representing the start of the hour during which the traffic was counted, the end of the hour, the total vehicle count for the hour and a map of vehicle type to count for the hour.
There are some in-depth examples based around the Java API here: Getting Started.