Switch branches/tags
gaffer2-1.7.0 gaffer2-1.7.0-RC4 gaffer2-1.7.0-RC3 gaffer2-1.7.0-RC2 gaffer2-1.7.0-RC1 gaffer2-1.6.0 gaffer2-1.6.0-RC2 gaffer2-1.6.0-RC1 gaffer2-1.5.2 gaffer2-1.5.1 gaffer2-1.5.0 gaffer2-1.5.0-RC3 gaffer2-1.5.0-RC2 gaffer2-1.5.0-RC1 gaffer2-1.4.1 gaffer2-1.4.0 gaffer2-1.4.0-RC4 gaffer2-1.4.0-RC3 gaffer2-1.4.0-RC2 gaffer2-1.4.0-RC1 gaffer2-1.3.0 gaffer2-1.3.0-RC1 gaffer2-1.2.0 gaffer2-1.2.0-RC1 gaffer2-1.1.2 gaffer2-1.1.1 gaffer2-1.1.0 gaffer2-1.1.0-RC1 gaffer2-1.0.2 gaffer2-1.0.1 gaffer2-1.0.0 gaffer2-1.0.0-RC5 gaffer2-1.0.0-RC4 gaffer2-1.0.0-RC3 gaffer2-1.0.0-RC2 gaffer2-1.0.0-RC1 gaffer2-0.7.8 gaffer2-0.7.7 gaffer2-0.7.6 gaffer2-0.7.5 gaffer2-0.7.4 gaffer2-0.7.3 gaffer2-0.7.2 gaffer2-0.7.1 gaffer2-0.7.0 gaffer2-0.6.6 gaffer2-0.6.5 gaffer2-0.6.4 gaffer2-0.6.3 gaffer2-0.6.2 gaffer2-0.6.1 gaffer2-0.6.0 gaffer2-0.5.1 gaffer2-0.5.0 gaffer2- gaffer2- gaffer2-0.4.7 gaffer2- gaffer2- gaffer2-0.4.6 gaffer2-0.4.5 gaffer2-0.4.4 gaffer2-0.4.3 gaffer2-0.4.2 gaffer2-0.4.1 gaffer2-0.4.1-RC1 gaffer2-0.4.0 gaffer2-0.4.0-RC3 gaffer2-0.4.0-RC2 gaffer2-0.4.0-RC1 gaffer2-0.3.9 gaffer2-0.3.9-RC2 gaffer2-0.3.9-RC1 gaffer2-0.3.8 gaffer2-0.3.8-RC1 gaffer2-0.3.7 gaffer2-0.3.7-RC2 gaffer2-0.3.7-RC1 gaffer2-0.3.6 gaffer2-0.3.6-RC2 gaffer2-0.3.6-RC1 gaffer2-0.3.5 gaffer2-0.3.5-RC1 gaffer2-0.3.4 gaffer2-0.3.4-RC2 gaffer2-0.3.4-RC1 gaffer2-0.3.3 gaffer2-0.3.3-RC2 gaffer2-0.3.3-RC1 gaffer2-0.3.2 gaffer2-0.3.2-RC1 gaffer2-0.3.1 gaffer2-0.3.1-RC1 gaffer2-0.3.0 gaffer1-1.3.0
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (36 sloc) 3.15 KB

Copyright 2016-2018 Crown Copyright

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This page has been copied from the Road Traffic module README. To make any changes please update that README and this page will be automatically updated when the next release is done.

Road Traffic Example


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
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

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.