0% found this document useful (0 votes)
69 views

Qgis Tutorial-Dynamic Infographic Map v1

This document provides instructions for creating a dynamic infographic map in QGIS using variable colors. It involves the following steps: 1. Install required plugins like QuickOSM and DataPlotly. 2. Add OpenStreetMap data to QGIS using QuickOSM and filter the data. 3. Add a new field to group municipalities and set variable colors in the QGIS project properties. 4. Style layers like municipalities and labels using the variable colors. 5. Create a print layout with elements like the map, legend, north arrow and charts. 6. Add charts showing municipality data, using expressions to link colors to variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Qgis Tutorial-Dynamic Infographic Map v1

This document provides instructions for creating a dynamic infographic map in QGIS using variable colors. It involves the following steps: 1. Install required plugins like QuickOSM and DataPlotly. 2. Add OpenStreetMap data to QGIS using QuickOSM and filter the data. 3. Add a new field to group municipalities and set variable colors in the QGIS project properties. 4. Style layers like municipalities and labels using the variable colors. 5. Create a print layout with elements like the map, legend, north arrow and charts. 6. Add charts showing municipality data, using expressions to link colors to variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

QGIS TUTORIAL

DYNAMIC INFOGRAPHIC MAP


DATAPLOTLY, QUICKOSM & VARIABLE COLOR

The purpose of this tutorial is to show how to make a design map using
QGIS and DataPlotly with the use of variables. It’s just my point of view and not an
official tutorial or best practice, but I hope you’ll enjoy to use it.

In this tutorial we will suppose that you already have QGIS installed and
we’ll need QGIS 3.24 Tsiler. We will use Openstreetmap data (“© OpenStreetMap
contributors”) with QuickOSM (Etienne Trimaille) and Dataplotly (Matteo Ghetta)
for charts. And to promote my country we will use Reunion Island data (but you
dan use another dataset)

Here I’ll use Poppins fonts from Google Fonts but you can use one of your choice

We will work by step:

1. Install plugins required


2. Add data to QGIS with QuickOSM
3. Filter data and add new field
4. Add variable colors to QGIS project properties
5. Set symbology for layers
6. Create a composer with standard elements
7. Add charts with expression for colors, text with expressions…
Table of contents
1 - Install plugins required ............................................................................................................................... 3

2 - Get data with QuickOSM .......................................................................................................................... 4

3 - Filter data and add new field ................................................................................................................ 6

4 - Add variable colors to QGIS project properties ......................................................................... 9

5 - Set symbology for layers ........................................................................................................................ 12

6 - Create a composer with standard elements ........................................................................... 18

7 - Add charts with expression for colors, text… ..............................................................................23


1 - Install plugins required
Go to menu -> plugins -> manage and install plugins

Install QuickOSM and Dataplotly. Select “All plugins” and in search bar add
the name of the required plugin then click install.
2 - Get data with QuickOSM
Launch QuickOSM

Then to get Reunion Island data just set QuickOSM, in quick query add
“admin_level” as key and “8” to value, then go down.
Set “in” and add “reunion”, extend “Advanced” and uncheck “Lines” and
“Multilinestrings” not needed for this tutorial. Then set the “Directory” to use to save
data and to finish click “Run query”. Of course, you can set other country and
parameter fitting your needs

Save your QGIS project !!!


3 - Filter data and add new field
Now we have to filter data to our needs. In this case we need to filter points
to the attributes “place” that are not null. Right click on points and select filter.

Be careful, this step is used only for this dataset and may be different with
another.

In the “query builder” window drop down “Fields” and double click to add it to the
query then add “IS NOT NULL” or “NOT NULL”

Otherwise you can just add the text manually or copy & paste it form here :

"place" IS NOT NULL

This query will filter points to get all the points wee need to label the map.
You should now have something like this.

Our municipalities can be group and we will add a new field “EPCI” to set it with an
expression. First, for a better understanding, rename points as “labels” and
polygons as “municipalities”
Select municipalities and open field calculator

Set field like this “Output field name” set “EPCI”, “Text (string)” as “Type” and a
length of “10” should be enough
Then add this expression:

CASE

WHEN "name" IN ( 'Entre-Deux' , 'Le Tampon' , 'Saint-Joseph' , 'Saint-Philippe' )


THEN 'CASUD'

WHEN "name" IN ( 'Saint-Pierre' , 'Saint-Louis' , 'Petite-Île' , 'Les Avirons' , 'L''Étang-


Salé' , 'Cilaos' ) THEN 'CIVIS'

WHEN "name" IN ( 'La Possession' , 'Le Port' , 'Les Trois-Bassins' , 'Saint-Leu' , 'Saint-
Paul' ) THEN 'TCO'

WHEN "name" IN ( 'Salazie', 'Sainte-Rose', 'Saint-Benoît' , 'Saint-André' , 'La Plaine-


des-Palmistes' , 'Bras-Panon' ) THEN 'CIREST'

WHEN "name" IN ( 'Saint-Denis' , 'Sainte-Marie' , 'Sainte-Suzanne' ) THEN 'CINOR'

ELSE ''

END

Click “OK” then now your layer is in edit mode click on save icon to save changes
in the layer. Next click on the pen to toggle off edit mode.

4 - Add variable colors to QGIS project properties


In this tutorial we’ll use project variables to set colors to save time in
configuring our elements. Then, if you change a variable, all elements (ex: polygon,
text, chart, svg…) will be update.
Now in menu select Project -> Properties

In variables click on “+” to add new variable


Now add variable name and value like this:

Repeat it to set all these variables:

color_1 #F20544

color_2 #4B83F2

color_3 #05F283

color_4 #FFC000

color_5 #C8C5D9

color_dark #131E40

Of course, you can use your own color palette

Don’t forget to regularly save your project


5 - Set symbology for layers
Double-click on municipalities and in symbology select categorized. Select
the field “EPCI” created previously for “value” and then click on classify.

You can remove the last category that contain elements with no values because
our expression should have set all values.

Here each municipality will take color depending on his EPCI name.

A default color palette will be set and we have now to set it with our colors.
Double-click on first category and select simple fill, then click on the button on the
right of the color, select variable and then color_1

Set stroke color to white and width to 0,46mm


Repeat for each other to get something like this

Now double-click on labels to set symbology. Choose “Single Symbol” and then
select “Single Marker”. Use white for “fill color” and set “Stroke color” to our variable
“color_dark”.

Now we will set label using background, round borders, callouts, shadows and
some positioning settings. There are so many options for labeling but we will see
just a little part.

Don’t forget to regularly save your project


Go to “label” just below symbology, select “Single Labels”, “name” as “Value” and in
“Text” tab “8 points” for “Size” and set “color” to our variable “color_dark”

Next, on “Background” check “Draw background“, set “Size X” to 3 points, “X” and “Y”
“Radius” to 2 points and because of Poppins font gap set “Y” offset” to “1,5” points.
Then set the symbology of the shape under “Shape” by clicking on it.
In background symbol, select “Simple Fill”, white for “Fill color” and use our
“color_dark” variable for “Stroke color”

In “Shadow” “Offset” to “0” and “Opacity” to 20%.


In “Placement” select “Cartographic” mode and “Distance” to 4mm

And to finish in “Callouts”, check “Draw callouts”, “Offset from feature” to “1,2” and
click on “Line style”.

In “Callout Symbol” select “simple line” and set color to our variable “color_dark”
You should now have a map like this.

6 - Create a composer with standard elements


Create a new print layout and name it as you like

In our print layout we will add first watermark text in background.


Add a new text box in the top of the page, in “Item Properties” add your text (here
‘POP’) and then click on “Font” under “Appearance” to get Font settings

The new panel is pretty similar to label panel. Set your font to a Black type if
possible, use an amazing size and chose a light color

For Poppins gap correction we should add

these values to get a good alignment but

this could be different with other fonts


You can copy & paste the text element, just change font size and bloc position.

You may have to change font, position and other parameters depending on the
font you choose. You can check lock elements to not be disturbed by these blocs
later.

Add a map bloc and in item properties, uncheck “Background” to remove white
background
Add a legend bloc and name it as you like (but we always add legend ) and set
parameters on Item properties. Remove background like for map, uncheck “Auto
update” and customize on your need. For me remove “labels”, set fonts and
rename municipalities
Add a North arrow on the map, select you SVG images and set parameter as you
like. Here “Fill color” to “color_5” and “Stroke color” to “color_dark”

Add rectangle on the right and set his properties


You can set blending mode to “Multiply” to get better effect and set fill color and
stroke like below

7 - Add charts with expression for colors, text…


Add a first chart, remove background, set blending mode to “Multiply” and
click on “Setup Selected Plot”
Set the symbology like this, select “Bar Plot”, “municipalities” for “Layer”, link to our
map, check “Use only features visible in map”, select “EPCI” for “X Field” and add
to_real(“population”) to “Y Field” because our field type is actual string (extracted
from QuickOSM). Then click on “Update Plot”.

Now we will add color corresponding to map and using our variables. Click on the
button next to “Bar color” and select “Edit”
Add the expression below, it’s an expression to map a color to a specific value of a
field

map_get(

map(

'CASUD',@color_1,

'CINOR',@color_2,

'CIREST',@color_3,

'CIVIS',@color_4,

'TCO',@color_5),"EPCI"

)
Add the same expression to “Stroke color” and update plot to get this

In the “Layout Options”, add these texts and set up your font with bigger sizes. Then
update the plot
For a second chart you can just copy & paste the first chart bloc. Then change
information corresponding to this, now we have density expression
to_real(“population”)/($area/1000). Change the title in “Layout Options” and
update plot

Add text with the text bloc and set the font size to correspond your needs.
We will alternate between different font size and font type to have some text that
can be aligned. For the next text we will use an expression to get population from
the “municipalities” layer with an aggregate function.

Use this expression to aggregate population after conversion to number.

aggregate( 'municipalities','sum',to_real("population"))/1000
I divided it by 1000 to use “K” unite, just add a “K” next the expression and set your
font

Then use this expression to count municipalities

aggregate( 'municipalities','count',$id)
Adjust elements positions and add a title of your choice

Add svg images and use variables for colors


After adjustments of positioning, you can add some elements of your choice
Of course, if you now change the colors from project variable, the print layout will
take it into account.

If you use this palette, you’ll could see the difference

#10454F, #506266, #818274, #A3AB78, #BDE038

#0B47BF, #2953A6, #F29727, #F2762E, #F24141

Of course, you’ll have to choose colors depending on what you want to show so
be careful. A graduated color should be used with symbology graduated for
example graduate color by population value. But there are much more steps to
do it with our dataset. If you want to know how, just let me know…
I hope you enjoyed this tutorial, don’t hesitate to contact me on twitter @Oneil974

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy