QGIS – POPULATION DENSITY
Are you wondering how to present the intensity of phenomena on a map? Unsure which cartographic presentation method to choose or how to execute it? Here, we will try to introduce you to one of the solutions using QGIS. We will guide you step-by-step through the process of performing a population density analysis. Thanks to this, each of you will be able to perform it on your own.
GETTING STARTED
For the analysis, we will need:
WILL
All yo need is to want it, we’ll help you with the rest
SOFTWARE
QGIS
v.3.16
So, not as much as it might seem.
We will take care of everything else 🙂
SOFTWARE
For the analysis, we will use the free and most well-known program, QGIS. Downloading it is very simple and does not require any secret knowledge from the user, just the type of operating system you have 🙂 Simply go to the website and download it. At this stage, that’s all.
Once you have the software, it’s time to load the data into the program.
DATA
Our analyses will concern population density, so we will need:
– demographic data
– administrative data
If you want your visualization to look better, you can add a base map or create one yourself. For this, you will need to download vector data, and in our case, we will do just that.
If you don’t know where to download the data and how you can use it, we invite you to our compilation.
DOWNLOADING DATA
If you want to perform the analysis without a base map (which we will create), download only the demographic and administrative data. You can skip the subsection on base maps [where you will find information on how to download data from the geoportal].
DEMOGRAPHIC DATA
The easiest way to download demographic data is from our sources. These are uniform data for the whole of Poland – developed and made available by the Central Statistical Office (GUS).
ADMINISTRATIVE DATA
We recommend downloading it directly from the website of the Head Office of Geodesy and Cartography. Download PRG: (administrative units) – extension .SHP.
BASE MAPS
If you want to go a step further, you can download a layer with topographic or general geographic objects. These will serve as a base in this case. We recommend downloading them from the geoportal. Now step-by-step, because downloading is not entirely intuitive.
1. On the right side of the Geoportal, there is a MAP CONTENT window (ZAWARTOŚĆ MAPY)
2. We are interested in data to download (dane do pobrania) [make sure they are marked as shown and expand the list].
3. Select TOPOGRAPHY (TOPOGRAFIA).
4. Wybieramy:
– General Geographic Object Database [BDOO]
– Topographic Objects Database [BDOT 10k]
——————————————————
BDOO – selected layers are used as base maps for Poland.
BDOT – selected layers are used as base maps for cities.
5. After selecting the databases, the map will highlight in blue.
6. On the left side, on the navigation bar, click the first icon ℹ️ [information]
7. Left-click on the area of interest.
8. A window will appear showing available data for the selected area.
9. Select [TOPOGRAPHIC OBJECTS DATABASE-BDOT 10k].
10. Another window will appear [choose data with the .SHP extension].
Done
LOADING DATA
Data can be loaded into QGIS in two ways. The first is using the LAYER tab. The second is by dragging the data into the program.
- Open the QGIS program.
- On the top bar, click LAYER [a list will expand].
- Click ADD LAYER.
- Click ADD VECTOR LAYER [no definition needed – you’ll understand].
5. A window will appear MANAGE DATA SOURCES / VECTOR
6. All you need to do is indicate where the data is saved on your computer and select those with the .SHP extension.
7. Don’t forget to press the ADD button
Another method (perhaps easier for you) is to drag the data you are interested in into the project window [the large white field]. We often use this method 🙂
From the administrative data, load:
– gminy.shp
From the demographic data, load:
– PD_STAT_GRID_CELL.shp
From the topographic objects database [as a base map]:
– PL.PZGiK.339.3262.OT.BUBD_A.shp [buildings]
– PL.PZGiK.339.3262.OT.KUMN_A.shp [residential complex]
– PL.PZGiK.339.3262.OT.PTKM_A.shp [road area]
– PL.PZGiK.339.3262.OT.PTWP_A.shp [surface water]
– PL.PZGiK.339.3262.OT.SKDR_L.shp [road]
– PL.PZGiK.339.3262.OT.SKTR_L.shp [track or track set]
– PL.PZGiK.339.3262.OT.SWRS_L.shp [river and stream]
We know it’s hard to keep track of what we downloaded from the geoportal, so for the uninitiated, we have a FILE with decoded layers.
PREPARING DATA
Before moving on to analysis, we will prepare the data to speed up and simplify the entire process. In our case, we need to trim the demographic data to the administrative boundary [SZCZECIN] and change the coordinate system [nothing difficult].
COORDINATE SYSTEM
After loading the data, the first thing we will do is change the coordinate system. Why? To make the administrative boundaries look as we recognize them.
- On the bottom bar of the main window, click EPSG 4258 [currently displayed coordinate system].
- A project coordinate system window will appear, select or search in the filter EPSG 2180 and click OK [we changed the displayed coordinate system].
OBJECT SELECTION
In our case, we don’t want all the municipalities in Poland to be visible, only the boundaries of Szczecin. So we need to select the object and save it as a separate layer.
- In the LAYERS window [where we previously loaded the data], we have the GMINY layer.
- Right-click and select OPEN ATTRIBUTE TABLE or click the table icon on the top toolbar.
- In the table, find information about municipalities, including their names. Find Szczecin and highlight it [just click on the object number – in our case, it is 2109].
- Another way to select is by using the tool [marked below – arrow on yellow background]. Click the tool icon and use the cursor to select the municipality of interest.
- In this way, the selected municipality is highlighted in yellow and it just needs to be saved as a separate layer.
- To do this, right-click it again in the LAYERS window and select EXPORT and then SAVE SELECTED FEATURE AS.
- Name and save it [the layer will be loaded under the name you choose].
- At this stage, we can uncheck the GMINY layer so it is no longer displayed or delete it.
CLIPPING THE VECTOR LAYER
We have demographic data loaded for all of Poland, but we need to trim it to the selected municipality. Creating a layer with the boundary of Szczecin earlier allows us to do this.
- Go to the VECTOR tab on the top bar.
- Select GEOPROCESSING TOOLS.
- Select CLIP.
- Choose PD_STAT_GRID_CELL from the list as the source layer.
- Choose SZCZECIN from the list as the overlay layer.
- Click RUN [a new layer named CLIPPED will appear in the layer window – you can rename it, but it’s not necessary].
CREATING CENTROIDS
We will convert the polygon layer into a point layer, which will be necessary for our analysis.
- Go to the VECTOR tab.
- Select GEOMETRY TOOLS.
- Select CENTROIDS.
- Choose the previously clipped polygon layer as the source layer.
- Click RUN [a new layer named CENTROIDS will appear in the layer window].
CHANGING DISPLAY STYLE
Changing the display style will help increase the readability of displayed layers. Below, we will show you how to do it simply.
1. In the layers window, click the Szczecin administrative boundary.
2. In the layer properties, select the STYLE tab.
3. Then select SIMPLE FILL.
4. Set the fill color to transparent.
5. Choose the outline color as you like.
6. You can also thicken the border by increasing the outline width.
For layers forming the base map, we suggest light gray, and for water features, light blue. You can create your own map according to your preferences.
ANALYSIS
As mentioned at the beginning, we will present the population density for the selected locality. In our case, it will be Szczecin.
Thanks to the above steps, the process of creating a population density map will be quick and intuitive.
- Go to the properties of the created CENTROIDS layer [double-click the layer].
- Go to the STYLE tab.
- On the top bar, set SINGLE SYMBOL to HEATMAP.
- Set the color palette – our favorite is MAGMA [1].
- Invert the color palette [2].
- Edit the color palette [3].
When editing the color palette, the most important for us is transparency management, especially if we decide to use base maps.
- On the gradient bar, set the opacity:
– for the lightest color to 0%
– for the remaining colors to 50% - Click OK.
After selecting the display style parameters for the layer, we need to set what will be displayed. We will display—load the so-called attribute weight—the total population, which is recorded in the column named TOT [in the downloaded layer, we have the option to display the population by gender and age groups per 1 km²]. In the same window, we can also set the radius. We don’t impose a value because it depends on the display scale and the effect you want to achieve. Play around with this parameter and see how you can display the data differently. Work some cartographic magic 🙂
SAVING THE PROJECT
If you’re satisfied with the result, you can export it as a graphic file and share it with others. Simply choose PROJECT from the menu, then IMPORT/EXPORT, and finally EXPORT MAP AS IMAGE. A window will appear where you can set several parameters. For us, the most important is the resolution, as it determines the quality and size of our map. We chose 300 DPI.
FINAL RESULT
Here is our population density map of Szczecin. We added a few elements such as the title, legend, and our signature to show that it’s our work. If anything in our analysis is unclear, if you have doubts, or if it didn’t work out for you, we encourage you to subscribe or contact us directly at office@gcore.pl. We will try to help.