Monday, 24 August 2015

Department for Transport

The Department for Transport releases road traffic estimates for Great Britain on an annual and quarterly basis, providing AADFs, or the yearly average of the number of vehicles passing a point on the road network each day. Data is collected by the Department for Transport either by manual counts from trained enumerators or automated traffic counters, with both methods classifying the traffic by type. The data for the sample period is then expanded into flow figures for publication. The visualisation displays the road use by vehicle type, as a number of small multiples, with the main image displaying the totals for the whole of Great Britain.

According to the Department for Transport, road traffic for all vehicle types rose in 2013 by 0.4% when compared to the previous ten years. All vehicle types showed a decrease over the same period, with a significant drop of 11.2% in the traffic of Heavy Goods Vehicles (HGVs), the only exception being a major increase of Light Goods Vehicles (LGVs) at 19.4%. The network of motorways and ‘A’ roads only makes up 2.4% of the road network, but carried 32.9% of all motor vehicle traffic and 65.6% of all HGV traffic (Department for Transport, 2014). A similar trend has been observed in London, where road traffic shows a decline in all vehicle types, with the exception of buses, coaches and cycling.

The Department for Transport also helpfully provide a shapefile with the check point attribute for joining to the raw data. Five classes were used in the classification, with graduated colours from dark blue to white, as well as graduated line weights, with a dark background colour to highlight the most travelled roads.

At the time of writing, graduated line thickness is not well supported in the QGIS d3MapRender plugin. However, to continue to visualise this with the use of plugin, without any zooming, could easily be done with the be done at this point with some tinkering the in the color.css stylesheet to restore the line thickness.

The data for each year's AADF had been joined to the road shapefile, so adding a popup with a basic spline chart to visualise the changes in traffic volumes at each check point would be a nice addition. To do this on the Viz tab of the plugin, simply select each years AADF attribute, click the add button, supply the name of "AADF" in the resulting dialogue, and then supply a set of labels (years 2000 through to 2013) for the x-axis.

Average Annual Daily Flows from the Department of Transport. Pan and zoom around the map, click on a polygon to view the details of the AADF.

However, with the addition of zooming, the borders of polygons (or width of polylines) are rescaled at each zoom level. To do this for each individual element of a layer would be too costly. Instead the plugin rescales the borders of polygons and width of polylines at the level of the entire QGIS layer. Graduated line thicknesses are therefore problematic when zooming. As a workaround to this issue, there are two choices:

  1. Remove the JavaScript that performs the re-scaling (preferred method) and manually patch up the color.css file
        // Zoom/pan 
        function onZoom() {
          vectors.attr("transform", "translate("
            + d3.event.translate
            + ")scale(" + d3.event.scale + ")");
          /*"stroke-width", 0.26 / d3.event.scale);*/
  2. Or, duplicate the original layer five times (for each symbol in the graduated classification scheme) within QGIS and filter each duplicated layer to display just the range of features for a given symbol in the chosen graduated classification. Then all five layers can be exported with the layer with the greatest geographic range chosen as the main layer. The plugin maintains the filter applied to each layer during the export. Of course, that introduces problems with binding popup information as none of the layers form the complete dataset…