Our MBA in Data Journalism students produced a series of tutorials as their final work in the Low Code discipline: Transforming data into guidelines without programming, taught by professor Adriano Belisário. This month you will be able to check out some of their work and have fun with the tutorials they created. Today you can check out the tutorial made by Filipo Cunha.
In this tutorial we will see how to create maps of rivers by state or region of Brazil using QGis and data from the National Water Agency.
Today, reports on natural resources are increasingly common and necessary to understand various social and economic phenomena. Our agricultural production, for example, is intrinsically linked to the distribution of water in a given region. The Northern region of Brazil has large rivers, while Rio Grande do Norte does not have completely perennial rivers.
In this tutorial, we will be able to identify the courses of Brazilian rivers by state or region using QGis. The objective is to create a step-by-step guide capable of helping to visualize our river basin.
LET'S GET ENVIRONMENTAL
Today there are several georeferenced databases and maps that we can use as a starting point. I suggest using the IBGE Maps Portal . Here you can find the most diverse maps by different territorial organizations, environmental information, among others. My region of interest is in the Northeast, but if you want to create a map in states that border other South American countries, I suggest starting by downloading the map of our continent. On the IBGE Maps Portal, go to the search: 'Display by themes' – 'Charts and Maps' – 'Continuous Cartographic Bases' – choose the option '1:250,000 scale' – and choose the option BC250 version 2017 (SHP). Then some options will appear below – you must choose the option 'BC250 – VERSION 2017 SHP LIMITES'. [You will find different scales for the map - this one covers practically everything you wanted to do] There is already a 2019 version on the website, but as the tip is to just get the division of country boundaries, this one is smaller and will suit us [No 2019 package there is no separate boundary map – it is within a series of maps but it is there too].
*SHP is the shapefile termination – used when we want to work with vector data
And to continue with our objective we will need the map of the Brazilian states. On the same Map Portal you will now choose the 'territory organization' option at the root. Then go to 'Territorial Networks' – 'Mesh of Federation units' – 'Mesh with all UFs' (has the limits of our territory since 1872). Our focus is the latest update of 2020 (again in SHP). [the folders may be out of order but just scroll down and find what you're looking for]. Did it go down? So ready! Now we can locate Brazil and the Brazilian states.
**Guys, these files are all zip files, so before working properly with them you will need to extract them to a folder of your choice.**
OBTAINING DATA FROM THE RIVERS
Now we will need a shapefile with the rivers of Brazil – we have many options. One thing you have to ensure is finding a database that has the variables you need, such as identifying the river by name , for example, or the length of the rivers ... A source with several maps is the ANA metadata catalog . Let's use the 2013 Multiscale Ottocoded Hydrographic Base (BHO) to enter this name in the search location. It has a much simpler shapefile called 'rivers' .
There is another hydrographic database (2017) but although it is more current – in this tutorial I want to be able to identify the rivers and in the 2013 database there is a shapefile with all the named rivers, which is not yet available in the 2017 database.
IMPORTANT TIP
If you want more detailed work on a specific river basin, it's worth searching on the ANA website for the basin you want to explore. This way you can download only the data to be worked on.
TIME TO WORK ON QGIS
I'm using version 3.18.3 (Zurich) but it won't make much of a difference if you're using another version. Basically what can change is the location of your desktop, which can be rearranged. When you open a new project your screen will basically look like this:
The first step will be to add a new vector layer. To pull up our first map – in this case, Brazil. You can go to Layer – add layer – add vector layer or just find the button (This “V”) for the vector layer. This one:
Go there and look for where you saved the map of Brazil – you must choose the SHP file. And then just press the add button for your map to appear as a layer.
It will look cute like this:
To change the color, for example, you can right-click on the layer. In this case, name it 'BRUFE250GC', and choose the 'properties' option. In 'symbology' you can choose different types of filling, colors, opacity... In the 'Labels' menu you can assign names to the states... but that is not our objective here.
Now let's load the Brazilian rivers on this map. Let's do the same procedure. Add new vector layer... find where we saved the shapefile, and add this layer. The map will look like this...
To make the processing work easier – we can disable the geoft layer and work with it unchecked.
IF YOU WANT TO LOCATE A SPECIFIC RIVER...
Let's right-click on the BHO layer (the layer with information about the rivers) and apply a filter [by clicking on filter].
In my configuration, the “Fields” side is on the right (but this may vary) we select the 'NORIOCOMP' option by double clicking, [more information see the data dictionary at this link ] then in the operations we put the = option and in the search by values – just press the all option. All the rivers in the country will appear. Just start typing in the search field and the options will appear.
[warning: If you want to select more than one river, just after choosing the first, go to the “operators” field and select 'AND' and then search again by river]
Important tip: many rivers have the same names so it's good to pay attention. After we write, for example, “Rio São Francisco”, some options will appear. It's important to test and find out if that's the river you want.
Now you will need to select the 'feature'.
All these little blue lines on the map are rivers called 'São Francisco', but I want to work with the famous “old Chico”. When you click with the “select features” box activated (the one highlighted in the top right corner of QGis - next to the “T”) on the river on the map it will turn yellow. Now just right click on the 'geoft' layer and export the specific feature...
A box like this will open to save the 'feature'...
NOTE: when saving, it is important to save in Shapefile format and have the option to save only selected features marked in the encoding.
Just name it and now the São Francisco River will appear as a new layer – you will be able to change color, etc. This can be applied as many times as you want. I applied the same procedure with the Açu River and Apodi/Mossoró River. It looked like this:
THE RIVERS OF A STATE...
But our goal is to know how to show all the rivers in a state. It will be simpler. Let's generate two maps of Brazil: one just for the state we want to show and another just without that state. Let's take the example of Rio Grande do Norte... Let's use the select features tool...
With the states' BR_UF layer selected, we click on the state of Rio Grande do Norte... (it will turn yellow)
Let's save the new features just for RN [following those same steps... right-click on the Brazil map file, 'BRUFE250GC', 'Export', 'save selected features as']. Then we select all states except RN and generate another 'feature'. To select the states, just click and hold the ctrl button. It will stay like this...
The next step is to place the layers in the right sequence. It works like a layer overlay, so just change the order of the layers to establish priority.
Then you will be able to view your map like this...
THE BIGGEST RIVERS...
This database shows the length of the rivers, so if you are only interested in larger rivers you can limit the rivers that appear. Just use the 'filter' feature:
The 'NUCOMPRIO' option can be selected through an operation such as = , <, >, among others... In this case, I only selected rivers longer than 30 kilometers....
Look at the difference:
FINALIZE AND EXPORT MAPS....
QGis brings many map possibilities, and can be used to illustrate and improve understanding with location data. But after these layers are ready - to have the product, one last step is necessary, which is the 'print composer'.
Create a name for your composition and click on the new map....
It is important to leave a margin to put the name of the map, observations or data sources... and when you create the area, the map created comes automatically.
One important area is item ownership. Here you can create a frame, change the background color – which can be blue to represent the Atlantic Ocean...
Another interesting tool is the automatic generation of a scale for the map....
The text box will allow you to create titles and fonts for that map... And you can of course open a new map under the same area to generate a better view!
I hope that in some way this tutorial has helped you develop skills or ideas on how the tool can help you with your stories. Until next time...
Please Post Your Comments & Reviews