Monday, 13 May 2019

All populated places in Great Britain in a single file

A data-sharing post today with details of a new file I've made to share with the world - or at least anyone who's looking for a comprehensive place names file of Great Britain to use in their maps. The short version: I've taken the 'populated places' from Ordnance Survey's massive Open Names dataset and made it available as a single shapefile, geopackage and geojson. You can see all the files, including a ready-made QGIS project file, in the project repository. I've also added this file to the Resources section on my personal web page, where you'll also find (e.g.) all buildings in Great Britain, parliamentary constituencies, and more. Here are some examples of what the file looks like. 

More than 42,000 places in a single file

You can have Gaelic or English place names

You can filter to show different kinds of places

You can also use Welsh place names, or English ones

In addition to the layers and QGIS project, I've also included some comments in the expression boxes in QGIS to explain how you do various things - like using different font size or CASE for different types of place name (e.g. for 'City' or 'Town' or 'Village'). See the screenshots below for more on this and look at the QGIS project if you want to see it in more detail and to change any settings.


This is how you make some labels bold

This sets a different label buffer for different types

This filter is used to show only some places

This determines the font size for different label types

This determines the CASE (e.g. upper/lower) for the labels

This sets the symbol size


That's all for now. Hope you find this useful. I've pasted below the text (including comments) that I've used for the labelling, just in case you want to copy/paste it quickly. As you can see, I've also used this to change 'Kingston upon Hull' to 'Hull' in a kind of find/replace way.

wordwrap((

CASE


WHEN "NAME1_LANG" = 'gla' THEN  "NAME2"

WHEN "NAME2_LANG" = 'gla' THEN  "NAME2"
WHEN "NAME1_LANG" = 'cym' THEN  "NAME1"
WHEN "NAME2_LANG" = 'cym' THEN  "NAME2"
WHEN "NAME1" = 'Kingston upon Hull' THEN 'Hull'

ELSE  "NAME1"


END


),14)


--If you want to show English place names in place of Welsh or Gaelic ones, or vice versa, or any combination of this then you just need to change the variables above.


--For example, in the first WHEN statement we are saying that when the language in the "NAME1_LANG" column is specified as 'gla' (for Scottish Gaelic) then we want to show the "NAME2" (English) label instead of the "NAME1" label (Gaelic).


--The wordwrap function at the start - and end with the 14 and brackets - just wraps place names on more than one line when they exceed 14 characters. Just delete this bit at the start and end if you don't want to do this.


-- You'll also notice that instead of displaying the default name of 'Kingston upon Hull' (which hardly anybody would use) I have used a WHEN/THEN statement to replace it with 'Hull' (which people actually use).

Sunday, 14 April 2019

Suffering from Brexhaustion? Have some more maps

This is the latest instalment in my series of ill-advised mapping adventures. I really don't know why, so long after that EU referendum thing, I am posting this today but I think it must be a mixture of being on Brexopilot and the fact that nobody seems to have mapped all the ward-level EU referendum data that Martin Rosenbaum of the BBC published in February 2017. I say 'nobody' but Owen Boswarva did map Bristol at the time, so I've borrowed some of his ideas for my maps. Note: there aren't maps of everywhere - only some areas released ward-level results data. Here's a little screenshot of the folder with all the maps. Scroll down to see the big versions.


Some explanation first, to describe what you are looking at. I used the ward results file at the bottom of Martin Rosenbaum's February 2017 piece to make these maps. I used shades of yellow for remain and shades of blue for leave. In both cases I used the yellow and blue from the original BBC maps as most people are familiar with that colour scheme. I mapped all 61 local authority areas that had results for all wards (36 'Leave' areas, 25 'Remain' areas). This covers about 15% of the UK but there is a good mix of area types so it should be somewhat representative of the wider picture. Here's a little visual explainer of what the maps show.

I think the local patterns are pretty interesting

The best way to see if an area you are interested in is in the map set is just to scroll down, because I've put all the maps below, in alphabetical order. You can also get them from the Google Drive folder, which by the way you can also get to by using this shorter and easier to remember url: bit.ly/brexit-wards-2016. At the very bottom of this post I've added a few more words, should you be desperate enough to read them.
































































Notes: I thought I would do this when the data came out in February 2017 but other things got in the way. With the recent Brextension (sorry) I thought I might as well finish the job I didn't start back then. Why? Partly because I was curious about what the local patterns actually looked like on the ground - apparent anomalies, concentrations, strongholds, that kind of thing - but also because I wondered whether there ware many 'islands of Leave' or 'archipelagos of Remain' and that kind of thing. I think if you look at the maps you can see a bit of this. I have used local authority boundaries because that is how the vote was conducted and counted, but I did also have a look at it by constituency (and then thought better of it).

Three Nottingham constituencies (East - Ind, North - Lab, South - Lab)


I was also interested in whether there were neighbouring wards that are really different in their voting. It turns out there are a few but not that many. If you're interested in this subject and haven't already read Martin Rosenbaum's piece on these local results, do take a look - it's really good. I did do a bit of analysis using the same data at the end of 2017, but that was just a few scatterplots. I should note, as Martin Rosenbaum does in his article, that this data was obtained thanks to a major data collection exercise carried out by George Greenwood.

I really would quite like to never hear the word 'Brexit' ever again though. Not because I have warm, fuzzy feelings for the EU but because it's all we ever hear about. So I thought I'd join in the fun and do some almost entirely unnecessary local Brexit voting pattern maps, even if it is just for the historical record. Though, actually, all this might be useful to people over the next six months, even if it's only for national media vox pop location planning (on which note, the KFC on the A127 in Southend seems like a good spot). Happy Halloween etc.


One of a few spots where near things are not that related