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.
Challenge accepted! Here is a transition between surface area of US counties and their associated population. This arguably provides a much more accurate reading of the situation. @observablehq notebook: https://t.co/wdfMeV5hO4 #HowChartsLie #DataViz #d3js https://t.co/lStHeeuMUw pic.twitter.com/MpYiXtsHmu— Karim Douïeb (@karim_douieb) October 8, 2019
What's a geometry generator in QGIS?
Want to know more about how to use geometry generators to style layers in QGIS, but not sure how? Watch the video, then download the file and play with it yourself #QGIS https://t.co/e8hgupctk5— Alasdair Rae (@undertheraedar) December 5, 2022
(a couple of the expressions only work in most recent versions of QGIS) pic.twitter.com/vtxCMD5q79
Polygons to proportional symbols with QGIS geometry generator + Atlas
- The polygons-to-circles-usa-v2 project file: polygons-to-circles-usa-v2.qgz and you'll also need to download the files below from the same folder
|Half way through the animation
- 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.
|You can also access this via the Symbol dropdown in Layer Properties
CASEWHEN x($geometry) < @atlas_pagenameTHEN buffer(centroid( $geometry),7000+ "total_votes"/30 ,50)ELSE$geometryEND
|What it looks like in the QGIS Print Layout