Showing posts with label great britain. Show all posts
Showing posts with label great britain. Show all posts

Thursday, 6 April 2023

The longest straight line in Great Britain (without crossing a public road)

In short, I believe I've found a longer straight line without crossing a public road than the line identified by Ordnance Survey in 2019. Important stuff, clearly. Let me explain.

**Update, 8 April 2023: I've added a Part 2 to this now, where I find an even longer line in the same area. Also, be very careful if you try this route because it won't be at all easy and you may also be eaten alive by midgies, as well as all the other hazards like bogs, hills, snow, cloud and so on.**

This is a longer straight line than the one below

Back in 2018 someone asked Ordnance Survey a question on Twitter, as follows:

"what (and where) is the longest distance you can walk in a straight line in England/Wales/Scotland without crossing a road (defined as a paved surface for vehicular use)??"

Note 'a paved surface for vehicular use'. This is the most important bit for me and the reason I'm coming back to it again after years of working with this data and never quite finding time to investigate, until now.

It's an excellent question. The answer the OS team provided was then turned into a blog post on the OS website in early 2019, and you can read that here but see below for their map. There's also a fantastic short film of Calum Maclean and Jenny Graham walking the route. 

71.5km or 44.43 miles

Now, let me say a little bit more. I'm from the Highlands, know lots of this area pretty well from my days cycling around it on my mountain bike when I was a teenager, as well as loads of other trips over the years for all sorts of reasons. I also spend my days looking at map data because that's a big part of my job and because of that one thing troubled me a bit about this answer from Ordnance Survey. 

To be more precise, once again, it's the 'paved surface for vehicular use' part of the answer. I'll explain all below and my maps are very rough and quick but you'll hopefully see what I mean. 


The roads data

Ordnance Survey provide loads of great open data these days, and one of those products is their OS Open Roads product. Load it into your GIS software and it looks like the image below. You can see from just eyeballing it where the biggest gaps in the road network are - unsurprisingly, all in the north of Scotland. There are some gaps in England and Wales too but here I'm trying to find the longest straight line between roads in Great Britain so I'm focusing on the north of Scotland. The longest line in Great Britain is also the longest in the whole UK, because the density of roads in Northern Ireland is such that there's nowhere even remotely as long as the line above there.

All roads in Great Britain


This OS roads file is about 2GB in size and is really useful. However, when I've run different kinds of network analyses on it I sometimes run into problems because it also includes roads that are not public. These are typically flagged as 'Restricted Local Access Roads', and I've shown some of these in the zoomed-in map below in purple. You may think by looking that these are 'roads' but in reality they are usually unpaved private tracks but more on that further down the page. 

Restricted 'roads' in purple here

What do these restricted roads look like on the ground? Well, you can take a look via Google street view a lot of the time, and you can also get a sense for what public roads are just by hovering the street view icon over the map, like I've done below.

A much better representation of public roads

For example, if you travel down the road along the River Findhorn, you'll eventually get to the end of the public road. You can of course keep going on foot or on your bike because of the laws on access in Scotland but you can't drive down these routes (unless you have permission). 


The end of the public road


Another 'Restricted Local Access Road' - see what I mean?

If you download the roads file and then make public roads one colour (blue) and then the restricted roads a different colour and then make a head-splitting gif of the result, this is what you get. Study this for a while and then you start to wonder if you can find a longer line than the OS one from 2019. Sometimes restricted access roads are in places like caravan parks, cemeteries, and the like - but in the Highlands they are often in the hills too.

Loads of restricted access roads (purple) on the map

Using what I would consider to be the 'correct' OS roads file - i.e. the one in keeping with the original question and in keeping with the concept of public roads - I can get a longer line in the original Cairngorms route too, see below. Let's worry about distance over undulating ground later on.

I can get a distance over 74km (straight line) this way

But with my glasses on I could see a potentially longer route, that just missed a couple of public roads, this time to the west of the A9 instead of the east. That's the map I posted at the start, and again below.

From the A9 to near Fort William, a nice walk

I've added terrain to this one, to show how tough this would be

Here's a height profile for anyone mad enough to be thinking about doing this route. It looks horrendously tiring and almost certainly quite dangerous unless you're a bit of an expert. Units are in metres below and the max is just about 3,000 feet, with lots of ups and downs. How much distance does this actually add to the straight line? 

Well, it's never as much as I'd think and it depends upon the accuracy of your terrain model but using the publicly available OS Terrain 50 dataset I get a distance of 77.0 km / 47.8 miles for this so a bit longer than straight line distance. I calculated this in QGIS using the Saga 'Profiles from lines' tool. 

A nice wee stroll

Anyway, that's what I get when I look at the data. A bit longer than the OS answer, but that's because I've tried to stick to the spirit of the original question. Get a different result? Found a mistake? Feel free to let me know.

Not easy

All these options are over 75km, and none are easy!

Data source: © Crown copyright and database rights 2023. © OpenStreetMap and contributors

Want the line file to play around with? It's in this folder, in geojson, gpkg, gpx and shp formats. File name is longest-straight-line-candidate followed by the various file extensions for each type.

Interactive map version of my original line 

How could you systematically, definitively find the longest possible route? With some difficulty but it could be done. My map above involved converting OS open roads to polygons, then vertices then connecting vertices then measuring the longest lines and so on. It's not a trivial problem to solve with 100% accuracy, at least not for me.

Tuesday, 20 December 2022

Population by altitude in Great Britain

This topic of population by latitude has always interested me, and it's something I've written about here before. But I'm also very interested in population by altitude, so that's what this short post is about - population by altitude across Great Britain. This is one of a few pieces I've had sitting on my computer, unfinished, for a while so I'm posting what I have now because I think people might find it interesting.

If you're interested in the topic more generally - and globally - check out this PNAS paper from 1998, it's very interesting. Okay, so here are my results, in the chart below.

Not massively surprising, but quite interesting

So what are we to make of this? Well, hardly anyone lives above 400 metres above sea level. In places like Wanlockhead (467m / 1,531ft) in Dumfries and Galloway or Flash (463m / 1,519ft) in Staffordshire there aren't that many people and actually these numbers are disputed because Flash is said to be the actual highest village in Britain. Either way, they are relatively high up. So, let's summarise those numbers a bit more.

  • About 50% of the population appears to live at 50 metres or lower
  • About 25% live at 100 metres or higher
  • About 3% live at 200 metres or higher
That's about all for today, apart from the map below and then a few words on method.

Uplands and lowlands of Great Britain


The method was basically this: take the Ordnance Survey 50 metre resolution elevation dataset for Great Britain. Take the 2020 WorldPop 1km population dataset. Aggregate elevation to an average value for each 1km cell across Great Britain then use that to sum population by altitude. Yes, this won't be perfect but I think the results are pretty decent given the data we have available. I haven't seen anyone else do these calculations but please let me know if you've done it and got similar/different results.


Wednesday, 1 September 2021

A village called Trumpet (and how to find it using open data + QGIS)

This post has two main purposes. The first is to highlight the often weird and wonderful place names of Great Britain, including the village of Trumpet in Herefordshire, recently visited by my colleague Philip Brown - hence the title. The second purpose is to show anyone who is interested how to filter and find them using freely available Ordnance Survey data and free GIS software (QGIS). I'll start with a little bit of information about the data, then some maps of interesting place names, and then at the bottom I'll share more for any aspiring data boffins who might not yet know how to do this. I use these kinds of datasets in my QGIS training sessions, so that's the real reason I've been playing around with this stuff lately.

Trumpet, Herefordshire

The first step is to grab Ordnance Survey's OS Open Names dataset - a free download, available in several formats, and no registration required. There are nearly three million points in this dataset (2,952,321 as of the August 2021 file) and for each point we have the name of the feature in English, plus Gaelic or Welsh where applicable. You can read all about it in the official user guide, but for now all you need to know is that for each point there is a column which tells us whether it's a populated place, transport node, landform, some kind of landcover (e.g. a forest), hydrography (e.g. a loch) or 'other' (e.g. a primary school). For this little blog post, I filtered the data so it relates to populated places only, and this gets us a total of 43,120 places across Great Britain. This is how the places are broken down by type in the OS Open Names classification

There are four places called 'City' in Great Britain - two of these are hamlets and two are suburban areas. there is also one hamlet called 'Hamlet' and one suburban area called 'Hamlet'. 

Maps of interesting place names

Right, let's try some maps of interesting place names now - I'll leave the labels on and messy, so you won't be able to see them all on every map but that's okay, this is just a bit of trivia.

Place's, right?

Note 'London Apprentice'

Lots of Saints

Map-on-the-blog

The only exclamation in the nation


Rhymes with scone

Nicely lined up


I detect a pattern

England has cornered the market

Cat places

Such vital, vital work

Hello Romans

Yes, you get the idea. I could go on forever but I won't - I'll just add a few more and then say a little about how to structure queries for this in QGIS.




How much longer caan I go on?

I thought this should go at the bottom


How to filter to find different places in QGIS

If you are a regular reader, or if you follow me on twitter there is more than a tiny chance that you might already be a bit of a GIS nerd, so this bit may be surplus to requirements. If not, and you want to know how to filter layers in QGIS, read on.

In the final map above I have shown places containing the word 'bottom', because I am very mature. To do this in QGIS, all I did was right-click the layer in the Layers panel, click Filter... and then enter the correct query into the Provider Specific Filter Expression box, as you can see in my screenshot below.

This is using the OS Open Names points layer

Here's the filter text, if you want to copy and paste it:


"TYPE" = 'populatedPlace'

AND 

(

"NAME1" LIKE '%bottom%' 


Explanation? There is a "TYPE" column and a "NAME1" column in the OS Open Names dataset so I've used these to filter the data to show only those places that are categorised as populated places, and only where the name contains the word 'bottom'.

On the last point, the LIKE operator looks for anything between single quotes - the % signs just ensure that QGIS finds anything with bottom, including anything with text before or after it. If you put in 'bottom' it would find only places called 'bottom', if you put in '%bottom' it would find only places ending in 'bottom' and if you put in 'bottom% it would find only places that start with 'bottom'. Note that you may read that the LIKE operator is case sensitive, but in my case I was using QGIS 3.16 and it was not case sensitive (I believe this is because only certain data types will require you to take case sensitivity into account - and in those cases you can just use the ILIKE operator).

Where you have variations of spellings, etc. then you might need to be a bit more creative - e.g. in the case of the 'st.' / 'st' / 'saint' map above. This was my query for that.

"TYPE" = 'populatedPlace'

AND 

("NAME1" LIKE 'st. %' OR
"NAME1" LIKE 'st %' OR
"NAME1" LIKE 'saint %' )

One thing that can be confusing is how to search for text that contains an apostrophe, because if you just put one apostrophe between single apostrophes (i.e. single quotes) and % symbols then it won't work. The solution is to add two apostrophes, as below.

"TYPE" = 'populatedPlace'

AND 

(

"NAME1" LIKE '%''%' 


How about the hyphen-hyphen-hyphen one? Well, that goes like this:

"TYPE" = 'populatedPlace'

AND 

("NAME1" LIKE '%-%-%-%')


If you just wanted to filter to show only places of your choosing, rather than filter to find some that contains certain bits of text, then it's just a case of using the IN operator and adding places in a comma separated list, in brackets, as shown below.

"TYPE" = 'populatedPlace'

AND 

(

"NAME1"  IN ('Aberdeen','London','Southampton','Middlesbrough','Liverpool')


Slightly different example below, where I've filtered the OS Open Names dataset using a different data type so that I can show all the 'lakes' in Scotland.

"TYPE" = 'hydrography'

AND 

(

"NAME1"   LIKE '%lake%' AND "COUNTRY" = 'Scotland'

Lots of these are tiny, but they do exist


Hopefully you get the idea - hours of fun, limitless possibilities for silly blog posts, but ultimately all this is actually very useful (as well as simple) and it's the kind of thing I do day-to-day in the course of my work.

Thanks for reading.

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

Saturday, 16 March 2019

Alternative Maps

This is a blog post about some maps of places that we don't often see on maps in Britain. I've had these stashed away for a while, since late 2017 when I wrote a piece called 'Alternative Maps and the Future of Brexit Britain', which you can see below. I've been thinking a lot more about this recently as part of my role in the UK2070 Commission, and also because I'm going to Redcar this week. But really this is just some personal musing about maps and in particular maps of the kinds of places that often seem to be left off the map, particularly in conversations at a national level. Scroll down for the maps. There's not too much more to it than that, but I thought looking at some of the less mapped places, with a bit of label re-sizing, was a good way for me to re-think my mental maps of the country, and that's really why I did them. Nothing profound.


You can probably read the text if you click to enlarge

I'm not asking for too much, am I?

I deliberately didn't add inset/locator maps to these

Too often we're blinded by the sun

Only peripheral if you're not paying attention

It's not that far away

A long way from London? 

Part of London?

Limited labels

I've gone crazy with the labels here

The Kingdom of Fife

I always think this part of the world is overlooked

Quite a big garden

So often overlooked

Definitely pretty central

Quite a bumpy landscape

A bit more label inversion here

Technically, this is not Shetland in a box

Greater Trowbridge?

Stafford and Cannock megaregion

There aren't a lot of maps of this area

There are a lot of people here

Like I said, this is just a few maps of places that we don't often see on maps. Or at least we maybe don't think of them as being nationally 'important' in the same we we do about major cities. In some ways that is understandable but I think it can't to any harm to change our mental maps and re-think how we think about the UK, where stuff is and where stuff should be.