Skip to content
Creates a choropleth using D3 based on UK postcodes
Branch: master
Clone or download
Pull request Compare This branch is 21 commits ahead of davidsoloman:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
data_preprocessing Change colors (yellow to green). Add grey for panels with no FIT data… Jun 13, 2019
frontend Change colors (yellow to green). Add grey for panels with no FIT data… Jun 13, 2019


UK map

The map shows how many percent of "feed-in tariff" (FIT) panels was put on the Open Street Map (OSM) for UK. It was initially created for OpenClimateFix contributors to indicate which postcode districts lack information about solar panels location.

How to use

To see the map, open the frontend/mapbox_uk.html file in the browser.

To get the newest data form OSM about the amount of solar panels in the UK postcode areas, type in the console:

python data_preprocessing/

The final data will be saved in frontend/postcodes_updated.json. The intermediate files (containing raw query results) will be saved in data_preprocessing/data.

The optional parameters for calculate_stats_for_postcodes (useful when updating only FIT data and by debugging):

  • --osm_from_pickle – instead of querying solar panels coordinates from OSM, use already saved data from the recent search
  • --osm_postcodes_from_json – instead of querying postcode for each solar panel from OSM, use already saved results from the recent search

To use th newest FIT data – download the latest files here and update them manually according to Methodology section.


FIT data

The FIT data used on the map come from this website. Each of the three files was manually pivoted (count for each Installation Postcode), filtered (Technology=Photovoltaic) and saved in data_preprocessing/UK_Installed_pannels as csv, with two columns:

  • first - postcode district names.
  • second - count of panels with given postcode

There are ~850k photovoltaic records in total; 14k of them (2%) with postal code UNKNOWN. The FIT files can be manually updated, accordingly to the specification above (unfortunately python crashed to open original xlsx files containing images).

Solar Pannels in OSM

The information about amount of solar panels provided for each postcode is retrieved in two steps:

  1. Solar panels are queried from OSM via overpass api.
  2. The closest postcode is queried for each solar panel via api

Then the statistics about number of solar panels are created. Panels are saved in OSM map in two formats - nodes (single point) and ways (area). To simplify, both single node and single way was assumed to be one solar panel.


The original file with postcode coordinates was downloaded from here (postcode-XXNN.* files). The file was preprocessed:

  1. Postcode shapes were simplified with Mapshaper asd saved as shp
  2. Original file was lacking several postcodes, which were manually added.
  3. File was saved as geojson: data_preprocessing/data/postcodes.js.


  • Add missing postcodes to geojson (they disappeared due to postcode shapes simplification): BN42, CF47, CH47, DA18, DT1, FY2, G34, GL1, XH1, OX28, PE35, PL31, TA15, TF5, TN1, TN10
  • automate downloading and preprocessing FIT data
  • approximate UNKNOWN postcodes (from FIT data)
You can’t perform that action at this time.