Saturday, 4 February 2023

Where is the most densely populated square kilometre in the UK?

After the recent release of England and Wales Census data for 2021 I decided to take a quick look at which areas have the highest population density. I've done this kind of thing before, for the whole of Europe and also in relation to thinking about measures of population density more generally - in short, my view is that using the arithmetic mean approach to density makes very little sense at the country level because it doesn't reflect how we actually experience density (unless we live somewhere like Monaco). That's why I came up with the very simple idea of using 'lived density' instead. But this piece is about my attempt to find the area of the UK with the highest population density in a single square km. And note that I say 'in the UK' in the title because the highest density area of the UK is within London - the highest densities in (e.g.) Glasgow, Edinburgh, Cardiff or Belfast are about half that of London's densest areas. Here's where I think the most densely populated square kilometre in the UK is, based on 2021 Census data.

This is the answer to my question - read on to see how I got here

Here's a map of the southeast of England (mostly) showing 1km density - brighter colours = higher density. There are a few very high density areas outside London, but not necessarily exactly where you might expect.

No big shock to find London has the highest densities

That London has the highest population density areas of the whole UK is not a surprise. Previously my calculations on the highest population densities in London led to figures in the range of 20,000 to 25,000 people in a single square km. But of course this refers to residential density, and my previous calculations arrived at a figure of about 120,000 people in a single square km for daytime population density (see below, where the top figure is daytime population and the bottom figure is residential).

Daytime density in parts of Central London is over 100,000 per sq km

The centres of cities such as Manchester and Birmingham in particular have some pretty high densities - over 10,000 per sq km - but London has by far the highest density and the largest number of areas above 15,000 per square km in relation to residential population density. If you're interested in daytime (i.e. workday) population density then I wrote about that in a previous post.

Okay, so where was I? Yes, trying to find the single square km in the UK with the highest population density. I can say UK with some confidence even though I'm only using data for England and Wales, like I've already said, because my previous analysis shows that the answer is definitely in London.

How do we estimate where the highest density is?

First of all, we attach the output area population data from the 2021 census to the 2021 output area boundaries and we get something pretty uninspiring, like the basic map below. There are over 180,000 output areas and they are quite small. This was all done in QGIS, but I've not really bothered trying to make it look pretty here because I just wanted to find the answer.

All output areas, with 2021 population data

Then we create a 1km grid that covers all of England and Wales. At this point I should point out that the answers you get when doing any kind of 'per sq km' calculation do of course depend upon where you draw your grid Shift it a little up or down, or left or right and you will obviously get slightly different results. But not radically different numbers (as we'll see later on). Also, if you're using output areas to do population density calculations - instead of a 1km grid - then your numbers won't make a lot of sense because the vast majority of them (90%) are under 1km in size. 

In fact, most output areas are tiny, as in the example from the Isle of Dogs in London (below), where we see one output area with a density figure of over 142,000 people per square km - but of course it's WAY smaller than a square km, which are illustrated with the big black lines and the big numbers. Using a population density figure like this would make no sense. This stuff is pretty obvious but sometimes people quote these kinds of figures without realising how small output areas actually are.

Dense? Yes. 140,000 per sq km? No.

Once I had the 1km grid overlaid on England and Wales I think used population-weighted centroids for the output areas and assigned them each to a single 1km grid square and then added up the total population in each. This is of course not perfect because output areas don't align perfectly with the grid but it's close enough in the areas of interest to take us closer to a plausible answer. Here's what that looks like in part of Manchester and Birmingham - messy maps but you get the point. The big numbers are the 1km cell populations and the small numbers are the output area populations.

Central Manchester wasn't like this 20 years ago

This rivals parts of London for density

Okay, so what next? Well, next was to filter for all those square km with more than 15,000 people. Bear in mind that at this stage we are still talking in rough figures because of the mismatch between output area boundaries and the grid - an example of this is shown below but you can see it's not a terrible fit - only those output areas with their population-weighted centroid within the 1km square are added to that square's total. So the overlapping ones with most population outside are assigned to a neighbouring square. Again, not perfect, but logical. The big numbers here are the population in each square - with only squares with more than 15,000 shown and labelled.

This is just of City Road in London

Surprised by the grid squares I found (below) that have more than 15,000 people? I did think Manchester would crack this list but not based on the 1km grid I used. Apart from that it's mostly what I'd expect. There's one square in each of Leeds, Birmingham, Leicester and Brighton and 63 in London. You might get some others in other places if you were to shuffle the grid around a bit. For example, I tried this in Portsmouth (a relatively very dense city) where the highest values on my 1km grid were approaching 14,000 per sq km. I managed to get a figure of 15,509 in a single square km by manually placing the square somewhere else (see below). But in these cases no matter what you do you're not going to reach London densities.

Portsmouth is a very dense city for the UK

The 67 1km squares with more than 15,000 people

Here are some zoomed-in versions showing the location of the highest density 1km squares across England (it's likely that these are also the highest in the whole UK, given that when I last did this Glasgow and Edinburgh had max densities of about 12,000 in any single square).

This is the Birmingham one

This is the Brighton one

This is the Leeds one

This is the Leicester one, to the east of the train station

The 63 London 1km squares, with population labels

Okay, get to the point mate

Run another filter and this time do it for over 20,000 in any single square km and what do you get? You get the map below, with three possible candidates for 'most densely populated square km in the UK'.

These areas all seem like plausible answers to my question

See below for the zoomed in versions showing more detail. The reason they are tilted slightly in this one and the maps above is because I changed the map projection so that the OpenStreetMap layer (© OpenStreetMap contributors) is nice and crisp because if you show it using the British National Grid projection it comes out a bit fuzzy, that's all. 

Notice London Marylebone in the square here

Bow Common Gas Works in the centre here

This area is around Upton Park

Okay, so which square should we choose as 'most densely populated'? Is it a case of just taking the one with the highest population figure? Maybe, but I wanted to investigate more first. In each case there are overlaps around the edges of the 1km squares due to the irregular shapes of output areas. But overall I believe it's the case that the numbers reflect pretty close to the true population so I think, based on my initial 1km grid, that the area in Bow (East London) is the most densely populated 1km square in the UK, with a total of approximately 21,000 people in the 1000 x 1000 metre square. 

Ah, but hold on now. What were we saying about moving the grid around and the impact it might have? Well, I also generated three extra grids and ran the calculations on those, so read on for my final answer!

The answer to the question is finally here

With my first alternative 1km grid I once again got figures of just over 21,000 in any given square km, but I got seven of these. With my next one I got three squares, two of which had more than 22,000 people in them. With my third I got three as well,, one of which had more than 24,000 people in it, and one of which had 23,000. See below for maps of these. The three top squares from my original grid are shown in red on these maps, for comparison.

Shuffle the grid, get more answers, but similar areas

Three alternative candidates

I think we have a winner

So, my initial grid seems to have not been very far off the mark in helping find the most densely populated square km in the UK. Yes, we could go on and on with grid placement, and do it programmatically but I think we're always going to end up in the same place, around Bow Common in East London. It's also encouraging that the 20,000 to 25,000 per sq km figures I previously calculated come out here too. By way of comparison, the most densely populated areas of Paris or London (or New York or Seoul) have more than 40,000 people in them, and some over 50,000.

The overlap here is the initial winning candidate from my search

So, based on all of the above, my answer to the question of where the UK's most densely populated square km is, is Bow in East London with a population of approximately 24,000 in a single square kilometre, as shown below. Yes, there is a bit of fuzziness in these numbers due to not being able to perfectly align grid squares to output areas but I'm fairly happy with the answer I arrived at here.

I think this is a plausible answer to the question I posed

Hey, hold on a sec! What, not more density numberwang? Yes indeed.

I'm happy with my answer, but just to prove beyond any reasonable doubt that in these kinds of things the answers you get depend upon your method I decided to cheat a little and see if I could use a random 1km grid approach to find any area with more than the population in the square above. This is not really in the spirit of the method because it's not applying a regular grid across England and Wales so I don't consider this the 'proper' answer. Instead, consider it an approach to find an even higher value, for research purposes. The location of the 'most densely populated square km' in the United Kingdom doesn't really change and that's the main thing. 

Here's what my 1km 'grid' looked line when I was on the hunt to find a higher figure than the square above. This is almost 28,000 separate 1km squares but they do not form a grid, so I consider this method a bit of a cheat so I don't use it as my final answer above, but I wanted to see what happened when you did it.

Lots of squares, but not a grid approach

Then we can filter for areas with above 24,000 people and see what we get. That's what's shown below, and the square from the answer above is highlighted in red here for comparison.

Ruh-Roh, spanner in the works? 

Is this now a showdown between West and East London for the title of 'most densely populated square km in the UK'? Well, maybe, but only if you're using this cheat method of single squares. So who wins on this approach? See below for the zoomed in maps with the numbers.

All over 24,000 here (remember this is approximate)

East London wins again (original winner in red)

So, as we can see, the answer to the 'where is the most densely populated square kilometre in the UK?' question doesn't seem to change, even if we cheat and allow ourselves to place our 1km squares randomly in order to maximise the single square total. The area in the map above has four new squares with 25,000 or more - though of course these numbers are an approximation of course, as I've explained above. This kind of cheating approach does however have the benefit of showing how areas of West London come close to being the highest density if we play a bit of gridshift.

What does this actually look like on the ground though?

Here's a Google Maps link to more or less the centre of the red square above, which is also pretty much in the middle of the blue squares. Here are some images from Street View - and recall that this is what about 25,000 people per sq km density looks like in London. This is half the density of the highest density places in Paris, Barcelona or New York, and about a quarter of the highest densities globally (found in cities like Manila, Cairo and Dhaka).

Burgess Street, E14

Broomfield Street, E14

Lindfield Street, E14 (still space for parks)

Are we done now?

Yes (for now).

Thursday, 2 February 2023

QGIS at 21

This post contains a few GIS related thoughts, offered in the spirit of sharing that's at the core of open source. A bit like QGIS itself, I hope. My goal is not to convince anyone that they should be using QGIS but rather to convince potential GIS users that QGIS is now, at 21 years old, a mature, robust, powerful product used by millions of users and thousands of major corporations and universities worldwide - as well as lots of small companies like my own

Like most open source software, it is free to download but for me that is very far down the list of reasons why I use it (see my list of 'Reasons I use QGIS' at the bottom of the page). Also, on the topic of free, I'm not going to explain how nothing is really 'free' because as we know everything has some kind of cost and with open source it is often in relation to training, maintenance and things like adoption friction, but I'm not going to talk about that here.

On the topic of 'which GIS software is best?' I've written before. I like to leave that to the end user, and there isn't one answer that is always correct. The answer will vary from person to person and from organisation to organisation, but in the past few years I'd say my experience working with lots of different people and organisations reflects what we see in these Google Trends charts. below. I first used GIS software as an undergraduate in the UK, using MapInfo. Then I got into ArcView in the United States as I continued my studies, and then continued with ArcGIS when I moved back to the UK. When I set up a MSc in Applied GIS in 2013/4 I taught using both ArcGIS and QGIS and now I only use QGIS. I think the QGIS line on the chart is a reflection of the maturity of the QGIS project at 21 - it's fully grown up!

This matches my own experience quite well

The situation is quite different in the US compared to the rest of the world, at least in terms of the Google Trends data (this also mirrors my own experience from working in this area over the past 15+ years). I've worked with lots of Google Trends data over the past decade - on a variety of news stories - and it's often a very close match with reality even if it's not perfect. 

But is this US chart a bad thing? Well, no. It's just different and it reflects different contexts and organisational structures and things like that. But it does also mean that perhaps there is an opportunity for lots of people to take a look at QGIS with fresh eyes, and that's never a bad thing. I think many people will be very pleasantly surprised. But really here I'd say if you're using the software you want to, it does what you want it to, and you're happy with it - that's all you need. I have noticed that some of my US colleagues and collaborators in large governmental organisations are very much embedded in the ESRI ecosystem, but equally I have worked with a lot of QGIS-only users across the private sector and academia in the US. There is plenty of room for a wide variety of GIS software, and indeed none at all. 

This seems to match my experience, perhaps others can comment

When I look at the desktop GIS landscape in the UK and nearby countries, it does feel very much like over the past decade - and past five years in particular - that things have switched more in the direction of QGIS. Again, the data here matches what I'm seeing on the ground and indeed what I'm seeing when I'm delivering training and advice to people across hundreds of organisation over the past decade, including well over 100 councils in England. But that's another story! Anyway, I really loved MapInfo when I first used it as an undergraduate so there's a bit of sadness here seeing its relative demise. I also very much enjoyed using the old ArcView (goodbye, old friend) and ArcGIS.

Early adopter?

Big recent QGIS jump

These are trends, not hard facts, but still useful info

Okay, so QGIS is on the rise, MapInfo has been on the wane for a while - if we go by the charts above and the experience of people on the ground, like me. And ESRI products have been changing and developing during this period and it seems like QGIS has filled a gap in the market. 

So, from a humble software project begun by Gary Sherman in 2002 to the GIS software of choice for newsrooms, corporations and governments worldwide, QGIS has truly come of age.

See below for a list of things I can't do in QGIS and then for a list of reasons I use QGIS.

QGIS is not 'free' in the sense that it costs money to produce, maintain and develop, of course, so that's why I encourage anyone who benefits from it to either contribute to the project directly or via their organisation. My own company (Automatic Knowledge) is a Sustaining Member of QGIS and we give money each year to the QGIS project, and I also try to contribute to the community in other ways - e.g. free tutorials, helping people directly with one-to-ones, and suchlike. Thousands of others do this too and that's part of why it's great software.

Exhaustive list of things I want to do in QGIS but can't


Reasons I use QGIS

1. Because it's powerful

2. Because it's fast: to download, install and use

3. Because it's cross-platform (I use it mainly on Windows but also on MacOS and Linux)

4. Because it's easy to get the job done with QGIS

5. Because it's regularly updated (okay, sometimes it feels like it's too regularly updated)

6. Because of all the great plugins that add extra functionality

7. Because when things go wrong a fix is never far away 

8. Because the documentation is great (and so many contributors help solve problems)

9. Because you can make stunning maps with QGIS

10. Because it can handle any data format I throw at it


99. Because the logo is nice

100. Because it's free and open source

Thursday, 19 January 2023

Animating a proportional symbol map in QGIS

Many people who read this blog will be familiar with Karim Douïeb's fantastic 'transition between surface area of US counties and their associated population' map, shown below.

I wanted to see if I could create something a bit like this in QGIS, using a geometry generator approach, so that's what this post is about. My end result is shown below, and read on for more information about my method. See the notes at the bottom of the page for a bit more detail. The version embedded below will be a bit small, so here's the full size, high-resolution mp4 if you want to take a closer look at it.

What's a geometry generator in QGIS?

In QGIS you can style layers in the normal way, as in any GIS software - e.g. by using a blue fill on a polygon and a white outline - or you can use the geometry generator option to style a layer in a different way. For example, if you had a set of points representing populations, you could turn them into spikes with the height based on their populations. 

You could display lines as a series of points, and all kinds of other options, all without having to create any new files. Or you could convert areas into proportional symbols, as I've done above.

Okay, so you may have read this and still be like 'what the what? what the heck does this mean?' and that's pretty normal actually because it's not necessarily an easy concept to grasp without seeing examples. That's why I created a sample file where you can drop it straight into QGIS and play with different geometry generator styles, as in the tweet/ thread below.

You can get really pretty fancy with geometry generators in QGIS and do all sorts of interesting things, some of which you can easily find if you search for geometry generator qgis on Twitter. 

The thread below is another example of what I'm talking about here - it ends up with me making a tartan t-shirt based on a geometry generator style and some point data in QGIS!

Okay, fine, but could we create something like Karim's animated map in QGIS? Well, I tried and I think I got reasonably close, so read on for more about it.

Polygons to proportional symbols with QGIS geometry generator + Atlas

Okay, first things first - if you want to replicate this style, you can find the QGIS project file plus the individual map layers in my training data folder - directs links to each file are provided below. Whereas Karim did this for the entire US, my example only includes the lower 48 states. If you already know what you're doing with QGIS this will be fairly straightforward but anyone with a bit of experience should be able to download the files and replicate my steps. Here are the files you'd need to replicate my work.

If you want to replicate my project exactly, you'll also need to have the Comfortaa font installed because that's what I used for the labels and in the Print Layout. You'll also need to open the Print Layout in the project and make sure you activate the QGIS Atlas (via the Atlas menu then Preview Atlas). I did this in QGIS version 3.24 so if you're having any issues try using the same version, or a later one. Last of all, if you want to add the QGIS logo like I have, you will need to change the file path for the Picture in the print layout. I put the QGIS svg logo file in the same folder as the files above.

As you move through the Atlas page by page, each of the counties changes from a polygon to a proportional symbol, from west to east, with the size of the symbol based on the number of votes in each county. This is not perfect, but it's a more proportional representation and it's all about testing the concept here. This is what it looks like half way through the set of QGIS atlas frames.

Half way through the animation

Once I got everything set up, I exported each page of the Atlas as a single png and then combined it into an mp4 as an animation, using ffmpeg. I've written about that process in a previous post. For the final version I added a pause at the end, then reversed it so it loops back and forth.

So what about the QGIS project file itself? Well, if you download it you'll see it contains:
  • A US states layer, to show the state outlines - simple black colour outline
  • A US cities layer, filtered to show a selection of cities across the US, and also labelled
  • A grey US county backdrop layer so that when the polygons turn to proportional symbols we still have some background behind it
  • And on top of the grey US county layer we have the red/blue county layer showing which party won in each county at the 2020 US election. This is the layer that has the geometry generator style in it. 
  • Plus the QGIS logo svg in the bottom right of the print layout. 
If you want to look at the all-important geometry generator style, just go to the Layer Properties for the red/blue us-election-2020-lower-48 layer and then double-click on the blue colour patch symbol then Geometry Generator to see the geometry generator style for the blue areas and then do the same for the red areas, as shown below. 

You can also access this via the Symbol dropdown in Layer Properties

This is the geometry generator style I used - it's pretty basic, but works well:


WHEN x($geometry) <  @atlas_pagename 

THEN  buffer(centroid( $geometry),7000+ "total_votes"/30 ,50)




What does it do, and how does it work? Well, the first bit after the WHEN uses the x coordinate of county centroids to change the shapes from west to east - this is because I used the longitude of each county as the Atlas page name. That's why @atlas_pagename appears in the expression. You'll need to think about this for a while if you're not used to how the Atlas tool works in QGIS but if you look at the Print Layout you'll see each page is named using x($geometry).

The next bit draws a buffer around the centroid of each county, to 7000 metres, then scales it using the total vote count, divided by 30 (otherwise the circles are HUGE, but I did experiment with this and scaled it loads of different ways). The 50 value just makes the circle smoother. Why 7000 metres for the buffer? Well, if it's much smaller then you can't actually see it at the scale I'm mapping at. 

The ELSE $geometry bit just says to QGIS to draw the polygon as usual until the Atlas page name (which contains the longitude) meets the WHEN condition above.

Confusing? Yes, probably if you've not used this before but feel free to download the project and have a go.

You'll also notice that in the Atlas tab I've done some other things, like set the page name using the format 0001, 0002, 0003, 0004 and so on. 

This is what the Atlas layout looks like at frame 2000, below.

What it looks like in the QGIS Print Layout

Okay, so can we create an animated proportional symbol map in QGIS? Yes, we can. 

Is it as cool as Karim's? No, but it does demonstrate the power of QGIS geometry generator styles and shows the kinds of things that can be done - and that's what this post is all about. 

This is example is fairly simple really but if you've not used QGIS in this way before it can be quite confusing - that's why I shared the simple geometry generator file plus the more complex project file shown here.

Want to replicate this but can't quite get it all to work? Feel free to get in touch.


If you want to actually create new geomtries (e.g. a new shapefile or geopackage) using a geometry generator expression, you can do it via 'Geometry by expression' in the Processing Toolbox.

Are the proportional symbols sized exactly to match the population? No, because the size is based on the buffer radius, but if you use a bit more clever maths in the expression you can get it spot-on. But if you do this, the smallest symbols will likely disappear.

What's the point of all this? The point is to test what kind of things are possible with geometry generator styles in QGIS and to share this with people who might be interested.

That's all for now. I may add further notes if there are any questions but I'm putting this post here as a more permanent resource for anyone interested in how to do this kind of stuff.

Wednesday, 11 January 2023

Label callouts in QGIS

This is a short tutorial about how to display label callouts (sometimes referred to as 'leader lines') in QGIS. This has been possible for a while, but not everyone knows it's possible, or how to do it. So long as you're using QGIS version 3.10 or later, you create callouts for your labels very easily. Before going any further, here's an example of a map where label callouts would be useful (below). And here's the map layer I'm using for this tutorial, in case you want to follow along with the same data.

Very crowded labelling in the Northeastern United States

In the example above, some labels are okay, but in New England in particular things are a bit crowded, and in some other cases as well we might need to move things around. And note that I won't bother making things look particularly pretty here at all, this is all about the method.

So, here's two useful things to know for now - this is just for information right now, we'll look at how to change things further below.

  • The Label Toolbar (it looks like the image below, and if you don't see it you can turn it on via the View menu then Toolbars). We can place labels wherever we like using the Label Toolbar.
  • Where to find the Callouts options for a layer. For this, you need to go to Layer Properties (easiest done via a double-click on the layer name in the Layers Panel, or via a right-click then Properties... then Labels and then the separate Callouts section - again, see below for a screenshot of how it looks, in this case in QGIS 3.26).
Yes, this is what it looks like!

Here's where you find the Callouts options

Okay, but why would we want to use callouts? 

Well, we want to make labels easier to read and because some states are small (NH, VT, etc) we just can't fit the labels on top of - or inside - the shape of the state. Not everywhere can be a Texas or a Colorado! And that's fine.

Also, anyone who has done any mapping - or even looked at a map - knows that labelling is super important. Done well it can make a massive positive difference. Done particularly badly and it could ruin a map.

Let's draw some Callouts

Now I'm going to add some callouts to my US lower 48 states layer that I showed you above. This is done in Layer Properties > Labels for the layer you want the callouts on. So the first thing I'll do in Layer Properties is tick the Draw callouts box (below) and then click OK to activate callouts. Oh, boo. Nothing happens, but that's actually fine. 

This is how we make callouts active

Next I'm going to use the Move a Label, Diagram or Callout button to move some of the labels in the Northeastern United States. It looks like this (below) in QGIS version 3.26 and should look the same - or very similar - on your version of QGIS too.

This is the important button!

Next, I hit the Move a Label, Diagram or Callout button as shown above, then I select the first label I want to move, just by clicking on it - in my case I did this for Vermont and as soon as I did I got a pop-up, which unless you know what it's asking you can be baffling! It's not a problem, just keep reading for how to deal with this.

This little window (shown below) is QGIS asking you to use a unique column in your attribute table so that QGIS can store the X and Y coordinates of where you move your labels to, more or less. But you don't really need do know that so just click OK when you see the Auxiliary Storage: Choose Primary Key window, as shown below. It should just be on fid by default but really unless you're into this kind of thing you can click OK. At the bottom of the blog post I tell you how you can reset this, if you need to.

You can just click OK here

Then, making sure you've still got the Move a Label, Diagram or Callout button selected, you can move a label to somewhere where it has more space - so it's easier to read. This takes a bit of time, judgement and skill but don't worry if you don't get it right first time.

See below for where I've done this for lots of states - quite messily I might add. But that's fine at first, you can experiment with it later. At this stage I'd usually move some of the other state labels as well, to improve upon their positions - e.g. Florida, California, etc. This won't add a leader line because that only appears if you move the label further away from the feature.

We've made some progress! Oh yeah

But let's say we want curved callouts, because they're nice, right? 

Let's try that instead. To do this, we go back into the Layer Properties, then Labels and then in the Callouts section we change the Style from Simple lines to Curved lines, as shown below. 

If you don't see all the same options as me, it's more than likely because you're using an earlier version of QGIS - or perhaps a later one. At this point you can also experiment with different curve options, like Curvature (a higher value here = a bendier line). For now I'm just going to accept the defaults and hit OK. You can always experiment with the settings later, including the different anchor points options.

The different callout options

Curvature, and other options

I've gone with curved callouts in the map below, and I've moved the labels a bit too, in an attempt to try and tidy things up.

Staring to look a little better now

Couldn't we just use state abbreviations in these states, like NH for New Hampshire? Yes we could. But sometimes we want full names, plus not everything can be abbreviated. 

What about callout colours, widths, font sizes, styles and so on? Good question. You can go back into Layer Properties and then Labels and then change all that in the Text and Callouts section, as shown below when I did it. I used a callout stroke width of 0.1 instead of 0.3 and I changed the font, added a buffer and a little shadow too.

This is starting to look a little better

What if, say, we want the callouts to point to the edge of the state rather than the middle? Well, that's something we can change in the callout options by changing the anchor points, as I've done below where I set the Feature anchor point to Point on Exterior.

The callout now points to the edge of the shape, not the middle

As you can see, I've gone a bit wild with the colours now (below), but just for fun. But you can also see that I've tried to make the labels all neat and tidy and get the callouts looking good too.

This is more like it - at least in terms of the callouts

So, to recap on this bit...

  • Make sure you can see the Label Toolbar
  • Turn Callouts on via the Layer Properties, in the Labels section, and pick what kind of callout you want.
  • Experiment with placement, as well as font styles, line styles and so on.
  • Experiment a bit more.

Other things to think about - e.g. different kinds of data

The example above uses US states, but there are lots of cases in countries, regions and cities across the world where such an approach is useful - e.g. where some labels will fit within features but some won't and you need to find a solution. 

Sometimes callouts are the solution. But sometimes we might want to have callouts on every feature. We can do that too, but it's not necessarily that obvious at first so let's have a look.

To turn callouts on for every feature (e.g. points, lines or polygons) - and actually see the callout lines...
  1. Go to Layer Properties for the layer you want the callouts on.
  2. Go to the Labels section and turn labels on.
  3. Within the Labels section go to Callouts and turn them on.
  4. I tend to use curved lines rather than straight lines, but it's up to you - it all depends.
  5. Now go to the Placement section, still within Labels - it should be below Callouts (see screenshot below).
  6. By default, the Distance in Placement will be 0, so when you turn callouts on you won't actually see a line unless you increase the Distance. The Distance here refers to how far the label is away from the feature (e.g. a point).
  7. You probably won't want to have callouts on every feature most of the time, but that's what this does. See below for an example with a US cities layer. Once you click OK to exit Layer Properties you'll see the result.
Placement is very important with callouts

We don't always want callouts, but sometimes we do

Once you've done this, you can of course move labels around using the Label Toolbar, just like you did before.

Other useful/important stuff

Okay, so we've got some callouts now, and that's fine. But as you can probably tell there are LOADS of other things you can tweak with labels so I'm not going to cover everything. It's just a case of trying this and then experimenting with all the options. However, there are a few extra useful and/or important things I think you should know.

Once I've manually moved labels using the Label Toolbar, how do I reset the label positions to get them back to how they were originally?

A good question! Further above when we started to move labels I mentioned how you get that mysterious Auxiliary Storage: Choose Primary Key window pop up when you start to move labels. I said to click OK, and that was fine because it works. But you may not have noticed that it changes the label placement settings under Data defined, as shown below. To reset this, just click the X and the Y and hit Deactivate and you should be back to the original default placement.

Not a lot of people realise this is here

When I turn on labels the callout goes to the centre of a point feature and I don't like that!

Okay, yes, this is a good thing to know how to fix. You can see below in my US cities example how the callout goes right into the centre of the dot. I don't want this so I need to change some settings.

Callout goes to centre of the point feature

Offset from feature is what you need to edit here

As you can see from the screenshot above, I've edited the Offset from feature setting to move the callout line away from the point a little bit - I think it looks better this way. You can also experiment with lots of other settings here, depending upon what you want to achieve.

What do Manhattan lines look like? 

Another good question. They look just like the example below. They are called Manhattan because of the street grid in Manhattan, which is all right angles - well, a lot of it. 

Just take time to experiment here

Okay, that's it for now. This post is a bit messy but I'll fix any errors or clarify anything that isn't clear if anyone gets in touch. See below for a little animation of different callout types - using a dataset for US cities. I wouldn't normally need to use callouts here, so this is just for demonstration purposes.

Hope you find this useful!

But I wouldn't usually use callouts in this case!