Friday, 27 May 2016

City Footprints

Earlier in the week I posted a map of London's 'economic hinterland' on Twitter because I've been working with commuting data and wanted to see what the economic footprint of London looks like. But, some people have been telling me that other cities exist - which is a fair point. Since I have the data and I'm just revising a paper on the topic I thought I'd look at a few others, but this time using lower level data - MSOAs instead of districts for the origins. The maps below show the proportion of people from an MSOA who commute to a given area. Only MSOAs with 1% or more going to a particular place are shown and the darker the colour the higher the percentage. These aren't exactly the same as travel to work areas but they do give a reasonable approximation of each city's economic footprint. As you can see, I did quite a few maps - click to enlarge, as ever.

Birmingham has quite a pleasing concentric pattern

Bradford has quite a wide footprint

Bristol - quite a neat footprint

Cambridge is a little wider than I expected

Camden - one of a few London Boroughs I looked at

Cardiff - clearly the major focus in South Wales

Cheshire West - I wanted to see how far into Wales it goes

Derby seems relatively tightly packed

Leeds - the second largest local authority by population

Leicester - another quite tight East Midlands labour market area

Liverpool - extends into Wales and south to Cheshire, as you'd expect 
Greater London - the light areas are only 1% of commuters, but still!

Greater London - same as above, but with some city labels

Manchester - only the 'underbounded' district here, but still dominant

Middlesbrough - an important northern labour market area

Milton Keynes - I think it has quite a wide footprint

Newcastle - clearly dominant in the North East

Norwich - a good example of a large regional labour market area

Nottingham is relatively symmetrical in labour market terms

Oxford - a relatively large footprint here

Plymouth is a major South West economic zone

Reading - I had expected this to be a little bigger

Sheffield is another major northern labour market area

Southampton - somewhat overlaps with London's fringe

Southwark - I wanted to see how this London Borough looked

Swansea - quite a wide footprint here

Tower Hamlets - interesting to see the dominance of eastern origins

Warrington - a strategic hub in the North West

City and Westminster - the ONS group these two together

York - quite a wide Yorkshire footprint


Should I patch all these together in one big animated gif? Of course I should.

Why isn't my city included? Good question. Sincere apologies.

Birmingham doesn't get enough love, and is so often overlooked, so I did a zoomed in version of MSOA flows into Birmingham, with a few place labels.

Click here to see the full size version


Notes: the maps give the impression that they are unclassified choropleths, but that is just for effect and because this is a quick map batch. The colour classification is the same in each (see below) and no areas with less than 1% commuting to a given place are shown. I used the UK Data Service Flow Data website to extract the data and QGIS 2.14 for the maps. Bear in mind that they are a bit rough and ready and only really for comparison. Also, each 'city' here refers to the local authority area, not the wider city-region. But I think it's interesting to compare places. You just need to bear in mind the spatial scale and relative size of the destination places. Birmingham and Leeds ought to have much larger footprints that (e.g.) Nottingham and Sheffield because they contain more jobs. Where are Scotland and Northern Ireland? These datasets come separately and are not part of the English and Welsh MSOA geography so are not mapped here.

I used the same classification scheme for all maps

Monday, 9 May 2016

London+ (or, another way of looking at London)

Just over six years ago, there was a bit of a fuss when a marketing campaign attempted to re-brand parts of Northamptonshire as 'North Londonshire' owing to the relative accessibility of places like Corby and Kettering for Central London commuting. This stands in contrast to the accessibility of some other places in the South East, such as Hastings. A few years after that I was working up something on the topic in the Guardian news room but it never went anywhere and I completely forgot about it until last week and the London Mayoral Elections, when I began to think again about the relative importance of London to everywhere around it. First of all, here's a map of the area I identified as 'London+', followed by a bit more explanation of what it's about. The whole area (including Greater London itself) contains 18.9 million people - more than a third of the population of England.

The whole area includes 118 local authorities and 18.9 million people

My idea was not to try to say any of the London+ areas are in or part of London but rather that they play an important role in the vast, complex London labour and housing markets - some areas more so than others, obviously. I wanted to identify areas that, owing to their physical and temporal proximity could be considered part of a much wider commuting and housing zone. This is far from new, but I wanted to base my analysis on a few principles, which I've set out in the slides embedded below. For this, I also used a quite generous 90 minute commute time to Central London, which can be approximated quite nicely on Mapumental, as you can see below as well.

Peterborough was included here but not in my final definition




I'm thinking of the whole London+ area as Greater London plus the surrounding local authorities that are most accessible in terms of getting into Central London. That's the main reason there is a big chunk of East Sussex missing. It takes about 50 minutes on the train from Brighton to London but about twice that from Hastings, even though Hastings is only about 15 miles further away. You'll see some other maps in the slides above, including some of the ones I've shown below.

Population density for 1km cells 

Areas of green belt are also important here
Commuting flows in the London+ area

Same as before, but with labels (click to enlarge)

What's the point of all this, then? It's not to annoy everyone outside Greater London by referring to them under the heading 'London+'. Instead, I'm trying to get a sense of the true nature of the inter-connectedness of London and its wider commuting hinterland: areas which depend upon each other in many ways but which have a variety of different governance, planning and infrastructure approaches and priorities. Perhaps it's time to talk about regional planning again.

Anyway, I thought I'd share this stuff now as it's been sitting on my hard drive for three years (apart from the last two commuting images, which I just added in for interest). 

Want to know which areas are in and which are out? Take a look at the spreadsheet and also the final map below.  



Post-script: try searching 'North Londonshire' on Rightmove - it still works. Is this big 'London+' area supposed to be a 'greater-Greater London'? Not quite. I think of it partly as London's sphere of influence in terms of potential commuting, partly as one big interconnected labour market area - with London the core but lots going on beyond and around it. Also, there are similarities here between my notion of London+ and previous conceptions of a London mega-region (e.g. Hall and Pain's work, below - with mapping by Nick Green).

The Hall and Pain area has an almost identical population

Tuesday, 3 May 2016

Map Scotland's Election 2016 (boundaries for download)

A short post today to share some data for anyone wanting to map the results of the Scottish Parliament election of 2016. Anyone can download the original boundaries via the ONS Geography Portal but I've done a little bit of extra work and created kml and geojson versions and also created a version of the 2016 boundaries with the 2011 results included (plus population and electorate data). Just remember that there are 73 constituencies in 8 regions but there are 129 MSPs. I'm guessing that if you plan to map it you already know that! Here's what the constituency map looked like in 2011.

There were 69 SNP, 37 Lab, 15 Con, 5 LD and 2 Scottish Green

You can download all the boundaries from this shared Google Drive folder. The contents are as follows:


  • Readme file with licencing info. It's all open data but you should read this.
  • Scottish Parliament Constituencies 2016 - geojson
  • Scottish Parliament Constituencies 2016 - kml
  • Scottish Parliament Constituencies 2016 - zipped shapefile
  • Scottish Parliament Constituencies 2016 with 2011 results data - zipped shapefile
  • Scottish Parliament Regions 2016 - geojson
  • Scottish Parliament Regions 2016 - kml
  • Scottish Parliament Regions 2016 - zipped shapefile
  • I also included a brief note on uploading and use in CartoDB and Google Fusion Tables

Change to list view by clicking the button to the top right


I don't plan to do any mapping myself but I have been working with the data recently so thought I'd share a few different file formats and additional data that I had on my hard drive. Feel free to use if you wish.

Finally, here's a reminder of how some of the constituency voting looked in 2011. A lot of yellow then so it will be interesting to see how it goes on Thursday of this week.

There are North East MSPs from other parties - e.g. 3 Labour

Glasgow will be very interesting this time round

South Scotland will also be a key battleground


Notes: I'm sharing these boundaries just in case anyone wants to use them in their own mapping. If you do use them I'd be interested in the results, so please do share via twitter or e-mail. As for me, I'm going to go out on a limb and predict a big win for the SNP. I just have an intuition about these kinds of things. 

Saturday, 30 April 2016

A bit about image formats

This may be the most boring blog post you ever read, but I think some people might find it useful. Also, given the title of my blog, it's about time I did something on image formats. Let's imagine you are making some images (maps, maybe, but it could be any kind of graphic) and you come to the end of the project and want to export the final images for use elsewhere for sharing and so on. Do you default to JPEG? Hopefully not. Do you use BMP? I really hope not. Do you default to PNG? (I do most of the time), or are you required to use EPS or TIF? These choices matter and that's what this is about. Take a look at the JPEG image below - click to enlarge it and you'll see that around the edge of the lettering it looks slighly fuzzy or shadowy. That's because the image has been compressed but also because during the compression some of the original image quality has been lost (that's why they say a JPEG is 'lossy').

The jpg format is not very good with big areas of the same colour

Now compare the following maps, all in JPEG format, which I've exported at 75dpi, 150dpi, 300dpi and 600 dpi. To see these and the other images below in their native form, take a look in the Google Drive folder I put them in. 

This is 0.145MB 
This is 0.423MB (2.92 times bigger than the one before)

This is 1.166MB (2.76 times bigger)

This is 3.003MB (2.58 times bigger)

If there were no compression, each doubling in dpi would lead to a file size four times bigger. As you can see, the rate of increase in file size actually declines with each doubling of dpi. But you shouldn't use JPEG for maps like this anyway. So let's look at PNG instead. PNG is also a compressed file format but unlike JPEG it is lossless. It's kind of a non-proprietary version of the GIF file format (which is patented). There are lots of good things about it, including the fact that you can have a transparent background. Here is the PNG equivalent of the above set, with file sizes shown again - as you'll see the file size is bigger than JPEG (without being massive) but if you look at them in their native resolution in the Google Drive folder you'll see that there is no image quality loss around the edge of block colour shapes, particularly the writing in the top left.

This is 0.463MB

This is 1.025MB (2.21 times bigger than the one before)

This is 2.238MB (2.18 times bigger than the one before)

This is 5.353MB (2.39 times bigger than the one before)

So, with PNG you get a bigger file size but the quality is better because it's lossless - and that's why it's normally the most appropriate format for images of this kind on the web. If you need higher quality - for publishing for example - then EPS is often required. Sometimes, it's TIF. TIF is, like JPEG and PNG, a raster graphic format and when you export from QGIS as I have done here there is no compression (that's another story). This means that doubling the dpi leads to a quadrupling in file size - you can see this in the Google Drive where I've taken the image above and exported it again but in TIF formats. 

Uncompressed 75dpi TIF - 2.122MB

150dpi this time - 8.492MB (4 times bigger)

I haven't uploaded the other two TIFs here as they get pretty big quite quickly. The 600dpi file is nearly 136MB. But that's where TIF compression can come in handy. The two images below are 300dpi and 600dpi TIFs, but I've saved them using LZW compression (one of the options in IrfanView - my free tool of choice but there are other ways, like GIMP) and they are much smaller. You can see the full versions of these in the Google Drive folder.

This is only 3.908MB (the original was 33.975MB)

This is only 10.314MB - 13x smaller than the uncompressed TIF

Okay, so where were we? Oh yes, don't make a lovely map and then ruin it by exporting to BMP. Also, don't make loads of maps for a book or other project without thinking about the image format the end user will need. I keep making this mistake, somehow! I haven't even mentioned Abraham Lempel, Jacob Ziv and Terry Welch, but I think I ran out of goodwill quite some time ago so I'll just end by saying that their LZW algorithm is what makes the last two images much smaller than they were originally.

With this post I've reached a new low. I promise something more exciting next time. But if this saves just one person from having to re-produce a map because they got the image format right first time then it's been worth it. Last of all, here is one more extract from a 600dpi JPEG where you can really see the fuzzy effect you get.

The fuzzy effect is more noticeable in blocks of red colour



Other stuff JPG or JPEG? TIF or TIFF? It doesn't matter. If you manually change the .jpg file extension to .jpeg you'll see that it still opens and looks the same. Also with .tif vs .tiff. JPEGs are good for where the colour values change a lot in a short space - like in photographs of people or places. Following tweets from Rob Pattay, I thought I'd add here that you can also reduce PNG size with a bit more post-export compression. I used IrfanView to reduce the 600dpi PNG from 5.23MB to 4.85MB (about 12% less). Also, you might notice that when you click on the TIF images here in blogger they end up displaying as JPEGs.