Mapping the urban forest

In collaboration with the Office for National Statistics (ONS) Natural Capital team, we have developed an experimental computer vision method for estimating the density of trees and vegetation present at 10 metres resolution along the road network for all 112 major towns and cities in England and Wales.

Team members

The need

Urban trees provide a wide range of environmental, social and economic benefits, such as improving air quality, and are known to be associated with lower crime levels and greater community cohesion. Within the ONS, the Natural Capital accounts team wish to create an inventory of natural capital across the UK for use in their processes. This project will focus on detecting urban-street-vegetation which can be difficult to detect with satellite imagery.


The main outputs of this work will be:

  • data products: 112 GeoJSON files describing the density of vegetation along the road network for cities around England and Wales.
  • reusable code and tools: An end-to-end image processing pipeline capable of replicating the data production process. This may be extended and/or used by other cities and areas within or outside of the UK.
  • a series of accessible and technical articles detailing various components of the project.

Data science

The project has been delivered in two strands:

The first strand is a data-engineering component, which deals with image data processing (API interaction, database backend, file storage, processing flow control, distributed computation, interpolation and development of an image processing API). This has involved a number of technologies and programming languages, including: Java, Python, R, Javascript, MySQL, queueing (beanstalkd).

The second strand is implementation of an image segmentation algorithm capable of detecting and quantifying the amount of vegetation present in an arbitrary street-level image. This component has been integrated into the first step, completing the end-to-end process. The segmentation algorithm has been developed in three sub-stages, starting with an MVP which used a “green pixel”-based detection method, a machine learning approach using random forests and Bayesian hyper-parameter optimisation, and finally a deep-learning approach making use of the latest image segmentation models used in autonomous driving research. The final model uses a Pyramid Scene Parsing Network.

Both stages have been written up in the form of technical reports. The final stage has been validated using ground-truth data from Mapillary Vistas dataset yielding a system capable of detecting vegetation with 90% class balanced accuracy (in terms of pixel-wise classification error).


Currently, the ONS Natural Capital team.

Code and outputs

  • Final report - Final abstract and technical report published on the main blog.

  • RSS Urban forest talk - slides used in RSS 2018 talk.

  • Google Street View image processing pipeline - technical blog post, detailing the data engineering component of the project.

  • Visualising the urban forest with R and Shiny - a technical blog post detailing a tool to visualise some of the project’s data using R by Joe Peskett.

  • GitHub: street-view-pipeline - end-to-end distributed Google Street View image processing code. (Python). The repository also contains example GeoJSON and CSV output data for Cardiff and has also been highlighted in the Data Science Campus’ technical blog

  • Github: openstreetmap-network-sampling - code for extracting road network data from Open Street Map (OSM), city polygon intersection and point interval calculation; this (Java) code is used as a pre-processing stage before use of the street-view-pipeline, the repository has also been detailed in our technical blog, along with an early discovery relating to the non-uniform distribution of sampled road network bearings.

  • Github: vegetation-deckgl - an in-browser visualisation built using Uber’s framework. (JavaScript), this repository also demonstrates use of the output GeoJSON data for visualisation purposes.

Further information

Please contact for more information.



September 2018: A technical report has now been released on our blog.


This page has been automatically generated. Click here to download this project description as a pdf or click here to download as a word document.