Category Archives: Data Graphics

Living Somewhere Nice, Cheap and Close In – Pick Two!

eastsheen

Skip straight to the 3D graph!

When people decide to move to London, one very simple model of desired location might be to work out how important staying somewhere nice, cheap, and well located for the centre of the city is – and the relative importance of these three factors. Unfortunately, like most places, you can’t get all three of these in London. Somewhere nice and central will typically cost more, for those reasons; while a cheaper area will either be not so nice, or poorly connected (or, if you are really unlucky, both). Similarly, there’s some nice and cheap, places, but you’ll spend half your life getting to somewhere interesting so might miss out on the London “experience”. Ultimately, you have to pick your favoured two out of the three!

Is it really true that there is no magic place in London where all three factors score well? To see the possible correlations between these three factors, I’ve calculated the ward* averages for these, and have created a 3D plot, using High Charts. Have a look at the plot here. The “sweet” spot is point 0,0,0 (£0/house, 0 score for deprivation, 0 minutes to central) on the graph – this is at the bottom left as you first load it in.

Use your mouse to spin around the graph – this allows you to spot outliers more easily, and also collapse down one of the variables, so that you can compare the other two directly on a 2D graph. Unfortunately, you can’t spin the graph using touch (i.e. on a phone/tablet) however you can still see the tooltip popups when clicking/hovering on a ward. Click/touch on the borough names, to hide/show the boroughs concerned. Details on data sources and method used are on the graph’s page.

The curve away from the sweet spot shows that there is a reasonably good inverse correlation between house prices and deprivation, and house prices and nearness to the city centre. However, it also shows there is no correlation between deprivation and nearness. Newington is cheap and close in, but deprived. Havering Park is cheap and a nice area, but it takes ages to get in from there. The City of London is nice and close by – but very expensive. Other outliers include Merton Village which is very nice – but expensive and a long way out, while Norwood Green (Ealing) is deprived and far out (but cheap). Finally, Bishop’s in Lambeth is expensive and deprived – but at least it’s a short walk into the centre of London.

Try out the interactive graph and find the area you are destined to live in.

kingspark

p.s. If you are not sure where your ward is, try clicking on the blobs within your borough here.

* Wards are a good way to split up London – there are around 600 of them, which is a nice amount of granularity, and importantly they have real-world names, unlike the “purer” equivalent Middle Super Output Areas (MSOAs). Using postcode “outcodes” would be even better, as these are the most familiar “coded” way of distinguishing areas by non-statisticians, but statistical data isn’t often aggregated in this way.

Visit the new oobrien.com Shop
High quality lithographic prints of London data, designed by Oliver O'Brien

The City of London Commute

Here’s a graphic I’ve made by taking a number of screenshots of DataShine Commute graphics, showing the different methods of travelling to work in the City of London, that is, the Square Mile area at the heart of London where hundreds of thousands and financial and other employees work.

All the maps are to the same scale and the thickness of the commuting blue lines, which represent the volume of commuters travelling between each home area and the City, are directly comparable across the maps (allowing for the fact that the translucent lines are superimposed on each other in many areas). I have superimposed the outline of the Greater London Authority area, of which the City of London is just a small part at the centre.

ttwf_cityoflondon

There’s lots of interesting patterns. Commuter rail dominates, followed by driving. Car passenger commutes are negligible. The biggest single flow in by train is not from another area of London, but from part of Brentwood in Essex. Taxi flows into the City mainly come from the west of Zone 1 (Mayfair, etc). Cyclists come from all directions, but particularly from the north/north-east. Motorbikes and mopeds, however, mainly come from the south-west (Fulham). The tube flow is from North London mainly, but that’s because that’s where the tubes are. Finally, the bus/coach graphic shows both good use throughout inner-city London (Zones 1-3) but also special commuter coaches that serve the Medway towns in Kent, as well as in Harlow and Oxford. “Other” shows a strong flow from the east – likely commuters getting into work by using the Thames Clipper services from Greenwich and the Isle of Dogs.

Try it out for your own area – click on a dot to see the flows. There is also a Scotland version although only for between local authorities, for now.

Click on the graphic above for a larger version. DataShine is part of the ESRC-funded BODMAS project at UCL. I’ll be talking about this map at the UKDS Census Applications conference tomorrow in Manchester.

Visit the new oobrien.com Shop
High quality lithographic prints of London data, designed by Oliver O'Brien

Tube Line Closure Map

anim

[Updated] The Tube Line Closure Map accesses Transport for London’s REST API for line disruption information (both live and planned) and uses the information there to animate a geographical vector map of the network, showing closed sections as lines flashing dots, with solid lines for unaffected parts. The idea is similar to TfL’s official disruption map, however the official one just colours in the disrupted links while greying out the working lines (or vice versa) which I think is less intuitive. My solution preserves the familiar line colours for both working and closed sections.

My inspiration was the New York City MTA’s Weekender disruptions map, because this also blinks things to alert the viewer to problems – in this case it blinks stations which are specially closed. Conversely the MTA’s Weekender maps is actually a Beck-style (or actually Vignelli) schematic whereas the regular MTA map is pseudo-geographical. I’ve gone the other way, my idea being that using a geographical map rather than an abstract schematic allows people to see walking routes and other alternatives, if their regular line is closed.

Technical details: I extended my OpenStreetMap-based network map, breaking it up so that every link between stations is treated separately, this allows the links to be referenced using the official station codes. Sequences of codes are supplied by the TfL API to indicate closed sections, and by comparing these sequences with the link codes, I can create a map that dynamically changes its look with the supplied data. The distruption data is pulled in via JQuery AJAX, and OpenLayers 3 is used to restyle the lines appropriately.

Unfortunately TfL’s feed doesn’t include station closure information – or rather, it does, but is not granular enough (i.e. it’s not on a line-by-line basis) or incorrect (Tufnell Park is shown only as “Part Closed” in the API, whereas it is properly closed for the next few months) – so I’m only showing line closures, not station closures. (I am now showing these, by doing free-text search in the description field for “is closed” and “be closed”.) One other interesting benefit of the map is it allows me to see that there are quite a lot of mistakes in TfL’s own feed – generally the map shows sections open that they are reporting as closed. There’s also a few quirks, e.g. the Waterloo & City Line is always shown as disrupted on Sundays (it has no Sunday service anyway) whereas the “Rominster” Line in the far eastern part of the network, which also has no Sunday service, is always shown as available. [Update – another quirk is the Goblin Line closure is not included, so I’ve had to add that in manually.]

Try it out

General Election Maps for 2015

ge_swingmap

When I first moved to UCL CASA back in 2010, the first online map I created from scratch was one showing swings in the general election that year. So it seemed fitting to update the old code with the data from the 2015 general election, which took place last week. You can see the resulting maps here – use the dropdowns to switch between headline swing, winner, second places, turnout % variations, majorities, political colour and individual party votes and X-to-Y swings.

Screen Shot 2015-05-11 at 15.09.08

My style of Javascript coding back in 2010 was – not great. I didn’t use JQuery or event AJAX, choosing instead to dump the results of the database query straight into the Javascript as the page was loaded in, using PHP. I was also using OpenLayers 2, which required some rather elaborate and unintuitive coding to get the colours/shapes working. My custom background map was also rather ugly looking. You can see what the map looked like in this old blog post. I did a partial tidyup in 2013 (rounded corners, yay!) but kept the grey background and slightly overbearing UI.

Now, in 2015, I’ve taken the chance to use the attractive HERE Maps background map, with some opacity and tinting, and tidied up the UI so it takes up much less of the screen. However, I decided to leave the code as OpenLayers 2 and not AJAX-ify the data load, as it does work pretty well “as is”. The constituency boundaries are now overlaid as a simplified GeoJSON (OL 2 doesn’t handle TopoJSON). For my time map, I was using OL 3 and TopoJSON. Ideally I would combine the two…

Link to the interactive maps.

ge_colourmap

Street Trees of Southwark

southwarktrees_rotherhithe
Above is an excerpt of a large, coloured-dot based graphic showing the locations of street trees in Rotherhithe, part of the London Borough of Southwark in London, as released by them to the OpenStreetMap database back in 2010. You can download the full version (12MB PDF). Street trees are trees on public land managed by LB Southwark, and generally include lines of trees on the pavements of residential streets, as well as in council housing estates and public parks. By mapping just the trees, the street network and park locations are revealed, due to their linear pattern or clumping of many types of trees in a small area, respectively. Trees of the same genus have the same colour, on this graphic.

southwarktrees_thinWhy did I choose Southwark for this graphic? Well, it was at the time (and still is) the only London borough that had donated its street tree data in this way. It is also quite a green borough, with a high density of street trees, second only to Islington (which ironically has the smallest proportion of green space of any London borough). There are street tree databases for all the boroughs, but the data generally has some commercial value, and can also be quite sensitive (tree location data can useful for building planning and design, and the exact locations of trees can also be important for neighbourly disputes and other damage claims. It would of course be lovely to have a map of the whole of London – one exists, although it is not freely available. There are street tree maps of other cities, including this very pretty one of New York City by Jill Hubley. There’s also a not-so-nice but still worthy one for Washington DC.

Also well as a PDF version, you can download a zip-file containing a three files: a GeoJSON-format file of the 56000-odd street trees with their species and some other metadata, a QGIS style file for linking the species to the colours, and a QGIS project file if you just want to load it up straight away. You may alternatively prefer to get the data directly from OpenStreetMap itself, using a mechanism like Overpass Turbo.

A version of this map appears in London: The Information Capital, by James Cheshire and Oliver Urberti (who added an attractive colour key using the leaf shapes of each tree genus). You can see most of it below. I previously talked about another contribution I made to the same book, OpenStreetMappers of London, where I also detailed the process and released the data, so think of this post as a continuation of a very small series where I make available the data from my contributions to the book.

The data is Copyright OpenStreetMap contributors, 2015, under the Open Database Licence, and the origin of most of the data is a bulk-import supplied by Southwark Council. This data is dated from 2010. There are also some trees that were added manually before, and have been added manually since, by other OpenStreetMap contributors. These likely include some private trees (i.e. ones which are not “street” trees or otherwise appear on private land.) Many of these, and some of the council-data trees, don’t have information their genus/species, so appear as “Other” on the map – orange in the above extract.

southwarktrees_book

Election Time!

electiontime

I’ve created an Election 2015 Time Map which maps the estimated declaration times that the Press Association have published. It follows on from a similar map of the Scottish independence referendum.

Each constituency is represented by a circle which is roughly in its centre (using a longest-interior-vertex centroid determined in QGIS). The area of the circle represents the size of the electorate, with the Isle of Wight being noticeably larger, and the Western Isles and Orkney/Shetland constituencies smaller, than average. The main colours show the expected time (red = around midnight, falling to green for the slow-to-declare constituencies late in the morning) while the edge colour shows the 2010 winning party. Mouseover a constituency circle for more data. Grey lines shows the constituency boundaries, created from ONS data (for Great Britain) and aggregating NISRA small area and lookup data (for Northern Ireland). You can download the resulting TopoJSON file, which is simplified using MapShaper. The data is Crown Copyright ONS/NISRA.

As the election approaches, and after the results come in, I hope to modify and update the map with other constituency-level data, such as the result itself.

Manchester – Languages and Jobs

Many of my visualisations have focused on London – there is an advantage of being in the city and surrounded by the data, which means that London is often the “default” city that I map. However, I’ve created a couple of Manchester versions of my popular maps Ward Words and Ward Work. Logistics and time reasons mean that I present these as images rather than interactive websites, although I used the existing London-centric website as a platform to work with the Manchester data. A bonus is that, by presenting these as images, I can use LSOAs which are more detailed than wards – there are too many of them for my interactive version to be very useable but they work well within a standalone graphic.

I’m only showing the top* result, and the way the categories are grouped can therefore significantly influence what is shown. For example, if I grouped certain categories together, even ones which don’t appear on the map itself, then the grouped category would likely appear in many places because it would more likely be the top result. It would therefore easy to produce a version of this graphic that showed a very different emphasis. (*Strictly, second-top for the languages.)

The maps were created using open, aggregated data (QS204EW and QS606EW) from the ONS which is under the Open Government Licence, and the background map is from HERE maps. Enjoy!

1. Languages second-most commonly spoken in each LSOA in the Greater Manchester area (click for a larger version):
second_languages_manchester N.B. Where the second language is spoken by less than 2% of the population, I simply show it as a grey circle. LSOAs have a typical population of around 1500 so the smallest non-grey circles represent around 30 speakers of that language.

2. It’s important to remember that, except in a single area, English is not represented on the map at all. If you show the primary language (i.e. English) to the same scale, the map looks like this:
second_languages_manchester_english

3. Here’s the equivalent of the first map, for (most of) London. Note I’ve changed the key colours here. I appreciate that it is difficult to use the key, as there are so many more languages shown, and the variation between the colours is slight – particularly as they are shown translucently on the map:
london_secondlanguages

4. The most popular occupation by (home) LSOA (again, click for a larger version):
manchester_occupation_adornedI’ve used grey here for the “Sales Assistant” occupational group, as this is the dominant occupation in large urban areas.

5. By way of comparison, and at roughly the same scale, here is (all of) London:
occupation_adorned
My interactive (London only I’m afraid) version is here – change the metric on the top left for other datasets.

Bad Maps

<rant> Three maps with glaring errors which I came across yesterday. I’m hesitant to criticise – many of my own maps have, I am sure, issues too (i.e. my Electric Tube map, on the right, is deliberately way off.) But I couldn’t resist calling out this trio which I spotted within a few hours of each other.

1. Global Metropolitan Urban Area Footprints

footprints

This is, in itself, a great concept. I particularly like that the creator has used the urban extent rather that administrative boundaries, which rarely follow the true urban extent of a city. The glaring error is scale. It looks like the creator traced the boundaries of each city’s urban extent in Google Maps (aerial view) or similar. All well and good, but a quirk of representing a 3D globe on a 2D “slippy” map means that the scale in Google Maps (and OpenStreetMap and other maps projected to “WebMercator”) varies with latitude, at a fixed zoom level. This hasn’t been accounted for in the graphic, with the result that all cities near the equator (i.e. most of the Asian and African ones) are shown on the map smaller relative to the others, while cities near the poles (e.g. London, Paris, Edmonton, Toronto) are shown misleadingly big. This is a problem because the whole point of the graphic is to compare footprints (and populations) of the major cities. In fact, many of those Chinese and African cities are quite a bit bigger relative to, for example, London, than the graphic suggests.

2. Where Do All The Jedi Live?

religions

The map is in the Daily Mirror (and their online new media) so it doesn’t need to be a pinnacle of cartographic excellence – just a device to get a story across.However, Oxford and Mid Sussex – 40% of the datapoints – are shown in the wrong place – both are much closer to London than the map suggests. The author suggests they did this to make the text fit – but there better ways to accommodate text while having the centroid dots in the correct location. It might take a little longer but then it wouldn’t be – quite simply – wrong. I’m somewhat disappointed that the Mirror not only stoops to the level of Fox News in the accuracy of their mapping, but appears to have no problem with maintaining such an error, even when readers point it out. It’s sloppy journalism and a snub to the cartographic trade, that just relocating whole cities for artistic purposes is not an issue, particularly as so many people in the UK have relatively poor spatial literacy and so can be potentially easily manipulated.

3. A London map…

breakfasts

I’m not really sure where to begin here. I’m not sure if any of the features are in fact in the right place!

North/South – The Interactive Version.

northsouth_large

As a weekend project, I’ve made an interactive version of my London North/South artwork.

As well as the blue and red house silhouettes, assembled in QGIS, I’ve added in GeoJSON files of the River Thames (from Ordnance Survey Vector Map District, like the buildings) and of tube/DLR/Overground stations – the location/name/network data is from this GitHub file and I’ve applied a custom styling in OpenLayers 2, with station name styling inspired by the NYC Subway signs. The positional information comes from an OpenLayers control – I’m using a utility function to modify the output to use degrees, minutes and seconds. Finally, the naming popup is a set of UTFGrid JSON files (with 2-pixel resolution) based on OpenStreetMap data for polygons. Where the polygon has a building, leisure or waterway tag, I’m extracting a name, if available, and showing it. The coverage here is therefore only as good as building naming is in OpenStreetMap. I could potentially add in street names in the future.

Try it out here.

All the Tweets

Cross-posted from Mapping London, edited slightly.

This is a map of geolocated Tweets for the whole world – I’ve zoomed into London here. The map was created by Eric Fischer of Mapbox, who collected the tweets over several years. The place where each tweet is posted from is shown by a green dot. There are millions and millions of tweets on the global map – in fact, over 6.3 billion. The map is zoomable and the volume of tweets means that popular locations stand out even at a high zoom level. The dots are in fact vectors, so retain their clarity when you zoom right in. The map is interactive – pan around to explore it.

If you think this looks familiar, you’d be right. Mapping London has featured this kind of social media ‘dot-density mapping’ a few times before, including with Foursquare and Flickr (also Eric’s work), as well as colouring by language. The key difference with this latest map is the sheer volume of data. By collecting data on geolocated tweets over the course of several years, globally, Eric has assembled the most comprehensive map yet. He has also taken time to ensure the map looks good at multiple zoom levels, by varying the dot size and dot density. He’s also eliminated multiple tweets that happen at the exact same location, and reduced some of the artefacts and data quality issues (e.g. straight lines of constant latitude or longitude) to produce perhaps the cleanest Twitter dot-density map yet. Zooming out makes the map appear somewhat similar to the classic night-time satellite photos of the world, with the cities glowing brightly – here, London, Paris and Madrid are prominent:

activity_westeurope

However it should still be borne in mind that while maps of tweets bear some relationship to a regular population density map at small scales, at large scales they will show a bias towards places where Twitter users (who may be more likely to be affluent and younger than the general population) live, work and socialise. The popularity of the social network also varies considerably on a country-by-country basis. Some countries will block Twitter usage altogether. And in other countries, the use of geolocated tweets is much less popular, either due to popularity of applications that do not record location by default or a greater cultural awareness of privacy issues relating to revealing your location when you tweet.

activity_edinburgh

Above: Twitter activity in central Edinburgh, proving once and for all that the East End is a cooler place than the West End.

From the Mapbox blog. Found via Twitter, appropriately. Some of the background data is © OpenStreetMap contributors, and the map design and technology is © Mapbox.