We recently felt like escaping to the seaside, but it’s quite far away from us and the weather was awful, so we settled for tea and cake nearby instead. That got me wondering how far it was to the (UK) coast, and which bit of the UK was furthest from the coast. So I dug out the data and plotted it on the map below. I’ll go into how I made the map too, plus some other related things that snagged my interest.
I wondered if there was already something online I could search for quickly, and I got two near misses.
First, there’s Distance to the sea, which is part of Doogal (good for lots of map things). This will tell you the distance to the sea from a UK postcode, but you would need to repeat this over all postcodes to get a UK-wide map. So, a simple route to an accurate answer for a single postcode, but not what I was after.
Second, there’s Mapping distance to the nearest coastline, which is part of the site of Joshua Stevens, a data science / visualisation / maps geek. This is lovely and very interesting, but it’s for the whole world. You can’t zoom in on just the UK, which is the bit I’m after.
The Joshua Stevens site did prove directly useful in that it pointed me at the data I ended up using.
Nice stuff from maps
Like my Dad, I sometimes just like looking at maps, particularly if they trigger learning new things. The big version of the map on the Joshua Stevens site has some very nice things:
- The point on land that’s furthest from any sea (in China).
- The point at sea that’s furthest from any land (in the South Pacific).
- These two point at the start of a Wikipedia rabbit hole – the geography concept called the Pole of Inaccessibility. Apparently there are two global land poles, depending on what you count as the sea.
- The way the sea is coloured reminds me of Voronoi maps, which I guess they are – particularly around small islands.
- The way the land is coloured looks like watersheds / drainage divides, which seem like a bit of chaos lurking in the countryside, that humans often use as the basis of national and hence cultural boundaries. By “chaos” I mean in the maths sense – a small change in starting conditions producing a potentially big change in outcomes.
So, in the case of the Nile Congo watershed, rain falling from a cloud over the northern bit of the Central African Republic will ultimately form part of the Congo and flow out into the Atlantic off the west coast of Africa. However, rain falling from a cloud just over the border (and watershed) in south-west South Sudan will ultimately join the Nile and flow out into the Mediterranean.
Please note that the map looks like it shows watersheds, but it doesn’t. Watersheds would rely on how hilly the land is (and I assume other things like how permeable rocks are) and not on distance from the coast.
I already knew about watersheds, although I’d not thought about them since secondary school, and I didn’t know the specifics of the Nile Congo watershed. All the rest was new to me.
The UK map
This is the map, and I’ll explain shortly how I drew it. This is just a static image, but if you click on it you will go to an interactive, bigger, map. This can take quite a while to draw, so please be patient. On the interactive map, hovering over a coloured dot on land or sea will show you the co-ordinates of that point and distance to the nearest coast. If you move your mouse around too quickly, the tooltip with the information can lag behind a bit due to how much data there is on the screen. The distances for the south east part of the Channel (below the darker band down the middle) will be to the French coast.
The distances on land seem to be up to 107 km, and the distances at sea go up to 280 km (although this will increase as the bounding box around the map increases e.g. out into the Atlantic).
I’ve labelled capital cities, plus a selection of other cities that are inland. The reason why the sea is clipped to a wonky rectangle (trapezium) is our old friend – the world not being flat. The sides of the trapezium are lines of constant longitude, and the projection I’ve chosen displays them as noticeably converging rather than parallel at this distance north of the Equator.
I think the difference in colour scale on land, and maybe the range of values too, is why this map doesn’t look so much like watersheds. If anything, it reminds me of an ice lolly after you’ve sucked it a bit. The edges are just frozen water, and so relatively pale, and the middle bit still has frozen flavoured and coloured stuff.
The values at sea are interesting in that they show where my pruning of data has gone too far. The UK map is cut out of a world map, that I used as part of the map of distance to the EU. I chopped out bits that I didn’t need, to speed up the calculations of distances. However, it appears that as part of this I chopped out the Isle of Man – I think this is the source of the lighter shading north of Anglesey.
I also like how it shows the path you can take to keep your distance from land – for instance approaching Inverness from the north east, going up the Irish Sea from the south, or going east between the north of Northern Ireland and the Hebrides.
Also – another statement of the bleeding obvious – it shows how pointy different bits of land are. Devon and Cornwall plus south west Wales are all light green, as you just can’t get as far inland before you reach a coast again. It’s a bit like a shadow that’s all penumbra and no umbra.
Drawing the map
As I mentioned above, I found this data via Joshua Stevens’ site. It’s actually from NASA. It shows the distance from the nearest coast, at land or sea, every 0.04 degrees, which is roughly 2.75 miles. To start with I wanted only values for land, but I thought that it would be interesting to include sea values too given that they were there and it would be a chore to exclude them.
Next came the problem of how it should look. It’s simple but tedious to check if a point is inside a shape, so even if I didn’t remove sea values, how could I make it clear what was sea and what was land given that I would show variation everywhere on the map? My first thought was to have a colour scale based on green for land and blue for sea, but that would depend on being able to tell land from sea.
In the end I cheated. I started off colouring the land a uniform green, and the sea a uniform blue (based on a handy Stack Overflow answer). I then applied a single colour scale for the whole map, using white to black dots, but the dots were partially see-through (31% opacity). This meant that each dot shaded the colour underneath it, rather than having to worry about whether to be green or blue depending on where it was.
Also, my first version of the background was a rectangle, i.e. with parallel sides, because I added a rectangle to the screen first. This meant there were triangles to the top left and top right that were just blue with no shading, which looked odd. To fix this, I added a rectangle (defined by latitude and longitude) to the geo data that drives the map, and fed it through the same D3 projection as is used to process the country outline and the position of the dots. This had the effect of narrowing the rectangle at the top, to make a trapezium that matched where I had distance data.
Other things from other people
While I was doing this, Matt Parker published an excellent video that asks if the official land area of a country is based on its flat footprint, or does it take into account the effect of hills and valleys? (This chimed with the watershed stuff from the Joshua Stevens map.)
He enlisted someone who actually knows what they’re talking about re. computers and maps, Dr. Laura Jane Graham. She’s published online the R code behind her results, which includes this excellent quote:
In the R package documentation for sp::surfaceArea they say:
It is often said that if Wales was flattened out it would have an area bigger than England.
This is clearly nonsense. But Wales and Scotland do have higher percentage increase when taking into account elevation.
While it’s not as obvious as the heights of mountains and hills, the question of sea level is surprisingly hard to answer, and I love the MinuteEarth video that goes into it.
Finally, the pattern on land in my map (not Joshua Stevens’) reminds me of the patterns you get on a Chladni plate, and Steve Mould has an excellent short video on that.