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).