Creating Flow Maps in QGIS # Lesson 26 of 29 # QGIS Tutorials.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] hi guys welcome to today's qgis tutorial lesson 26 in this video we'll learn about flow maps in qgis if you haven't subscribed to my channel please do so so that you can get a notification when i upload my next lessons if you're new to my channel you can follow all my previous useful years tips and tricks from the links in the descriptions below let's get started so flow maps are a type of thematic maps used in cartography to show the movement of objects between different areas it can be migration data of people animal or products so the points to note are the magnitude in the flow line is represented by the thickness two they are drawn from a point of origin and three arrows can be used to show direction of movement so let's go to kgs and look at today's exercise so open qgis and we'll open up we'll create a new blank project for my case i've already created a new blank project here we're going to start by adding some word layer in qgis so below here you can see i have coordinates the section coordinate section i'm going to just delete everything there and type the word world so that i can bring in a temporary layer for the world now we have the world uh shapefile on our qgis now i'm going to look at the attribute table to see what information my attribute table has and you can see it has the names of the countries this is very very good actually we have the names of the countries and then we have just other country codes and all that so what i'm going to do is first i'm going to create centroids out of my polygon layer you can see these are polygons so i'm going to create centroids how do we create centroid we'll go to vector then we're going to go to the geometry tools then under the geometry tools you can see the first or the first tab is the centroid so i'm going to select centroid then my input layer in this in in this is the wild world map then i'm going to just create temporary layers for the centroid so i'm just going to click on run to create temporary layer and you can see i have centroids for all all my data here so now that we have the centroids i can even actually remove the world map here but i don't want to remove it so the next thing i'm going to do is i'm going to just do a little bit of edit into in my center when i look at the center it still has the same information but the only difference is that it has some fid here so we i'm actually interested in the names of these points only so what the next thing i'm going to do is i'm going to do some little bit of edit i'm going to delete all these other columns and remain with only the name column and maybe say only the name column is okay so i'm just going to remain with the name column so i'm going to click on the yellow pencil here the toggle edit then everything here now becomes active so i'm going to delete fields and i'm going to delete the fid the iso the everything else it doesn't remain with the name so i'm just going to say okay and i now have the names only so i'm going to click on save then stop editing and now i have my centroids have actually the names of the different countries so each and every dot here represent each and every country in the world so the next thing i'm going to do is i'm going to now actually look at i'm going to actually now add the geometry attributes for my points i want to know the x coordinates and the y coordinates of whatever information i have created here so i'm going to open the attribute table again and then now we want to add another column here so in this in the tabs here you'll see there's a tab here called open field calculator so you're going to select open field calculator because you want to now calculate the geometries of all these and they're going to create a new field here the the field name is going to be we we're going to start with the longitude or the x coordinate so x coordinate and for this one i'm going to call it the destination x coordinate destination now it cannot it can actually be a decimal number so i'm going to put it to four decimal places then i am going to now come here and look for the geometry and then i'm going to look for the x with the dollar sign so x x is a dollar sign which means it's a coordinate the x coordinate so i'm going to select it and add it into my formula here then i'm just going to say okay and it will actually populate my x coordinate and you can see the x coordinate destination then the next thing we want to do is now we want to have a y coordinate destination so i'm also going to do the same thing i'm going to go back to my field calculator again then this time is the y coordinate and this is also my destination so it's a decimal number again and then i'm going to put it to four decimal places then i'm going to now go to these operations here i'm going to look for the geometry and then i'm going to look for the y with a dollar sign so i'm going to select y this is y and you see it returns the y coordinate of the current feature so i'm going to double click on it too just bring it to the formula here and then click on ok and you see now it has population populated there y coordinate of it has populated the y coordinate of my destination so for my origin i want these uh goods or whatever kind of movement you want to show i want it to come from somewhere so i wanted to come from kenya which is my country to all these other parts of the world i want every everything like if it's for good goods or maybe say people or flights or something like that or the products moving from uh kenya which is my country to all these other kind of regions so what i'm going to do is i'm going to now look at the coordinates of kenya and see what is what are the coordinates of kenya and that is that that will be my origin coordinate so in this case we need to actually have the origin coordinates and the destination contents but the destinations we've already got in them and they are for the all of the different countries in the world so what i want to do is now i want to put the origin coordinate so i'm also going to go back to here and then i'm going to create now a new a new column here again so i'm going to just create a new column here and call it the x coordinate origin then this is a coordinate origin then this is the it's also a decimal number i'm going to put it to four decimal places then i'm going to click on ok so now we have the x coordinate origin all of them are now after creating the x coordinate origin you're also going to create a y coordinate origin because you want them to originate from one region which is kenya and go to all these other regions so the next thing i'm going to do is i'm also going to create a another column here for the y coordinate origin then it's a decimal number then it's two four decimal places and everything is okay here now so i have the x coordinate origin y coordinate origin i already have the x coordinate destination and the y coordinate destination so what i want to do is i want to auto fill my x coordinate origin with the coordinates of kenya here this is kenya so this is my point of origin this is actually where everything is actually originating from first of all i'm going to just look for where kenya is so i'm just going to scroll down here and i can actually even just arrange them in ascending and descending order so i'm going to look for kenya kenya uk and we have kenya here and then x coordinate destination now will be our origin because we are actually originating from kenya to all the other parts of the world so i'm going to copy i'm going to copy the x coordinate of kenya so i'm going to copy cell content then i want to auto fill it here so how do i do that i'm going to go to now and uh just below the the toolbar i'm going to select now the x coordinate origin which is equal to i can use an expression here but i can just put it i can just paste that coordinates but now i need to press it with single quotes for it to work so the x coordinate origin is equal to 37.8228 for x so i want actually everything here to be 37.822 so i am going to update all because i have already selected the x origin i'm going to update all not updates selected because if i just say update selected it will only select update this selected so i need to update all this column so i'm just going to click on update all and it actually updates the whole column with there this value now i want now to do the same thing to the y coordinates so i'm going to select the y coordinate of the drop down here is equal to and then i'm going to look at kenya again the y y coordinate destination i'm going to copy i'm going to copy the cell context 0.509 then i'm going to paste it here and i have it here now make sure that you it has a single quotes then i'm going to say update all again and you can see now i have updated the x origin and the y origin with the coordinates of kenya so the next thing i want to do is i want now to create my flow map so if you want to create your flow map you will need to install a plugin into qgis that is going to help you create the flow map and the plugin that you're going to install is called the share tool so i'm going to close this i'm actually going to click on save edits then i'm going to stop editing so i have my x coordinate destination y coordinate destination x coordinate origin and y coordinate origin the x coordinate origin and y coordinate origin at the same point so the destination is now what is different so i'm going to click on close now the next thing i want to do is i want to now install the plugin that is going to help us in creating our flow map so i'm going to go to plugin manage and install plugins then i'm going to search under all for the shape share tools and you can see i have shape tools here i have already installed it if you haven't installed it you can actually install it by selecting the shape tools and installing the plugin i can even see there is a new version available so i'm going to just upgrade my plugin i'm going to click on upgrade and it will pretty take my very short time to upgrade my plugin and you can see the shape tool is a connection with your basic shapes and tools creates so you can actually just read through these and the tool that you're actually interested in is the tool which is included there the xy to line so we are very very interested in this tool here i'm going to click on close after i have installed my plugin then my plugin has been installed on my computer i think it's here you can see it has so many functionalities so we are now going to go to the next step which is now creating our our flow map we're going to be using this centroid which are still temporary layers you can make them permanent if you want so for us to create very nice warm ups we this being our point of origin and all these others being our point of destination there might be flights there might be products and everything or migration of just people so what you're going to do is we're going to go to the job processing tool box then i'm going to look for the shape tool shape tool and you can see the shape tool has so many functionalities what you're interested in is the xy2 line so you can even type here xy2 live if you want xy to line and then you can see i recently used it so i'm going to just select it it's under the vector geomet geometry so i'm just going to select it then the input layer is there centroids for the all all of these countries then the input coordinate system i'm going to use to just leave them the way they are like that the apg-436 which is the geograph the geographic coordinate system then i'm going to scroll down and then there is a line type i'm going to select instead of geodesic i'm going to select great circle then i'm going to scroll down again here what is your stats x field which is there longitude what is the stat where are we starting from i'm going to select the x coordinate the origin which is our start point then start y which is the latitude i'm going to now select the y coordinate which is our origin so we have already put our starting points now we're going to the end points now the endpoints the x is now going to be the x coordinate destination then the end y field is going to be the y coordinate destination so we are moving from this origin to this destination then i'm going to say i'm going to leave everything else the way it is then i'm just going to say run and it will take a little bit of time to just process whatever you put it put in there and then it says the xy2 line has finished the algorithm has finished so i'm going to click on close and wow you can see now we have very very nice lines moving from our point of origin to the destination to the different distinctions in the world so we want to actually even look at these points we talked about the magnitude of the flow is represented by the thickness so we want to look at these thickness how can we add this element of thickness so that you can actually see which areas actually have more flow than others so what i'm going to do here in my flow line now that i have i'm going to open the attribute table so what i want to do is i want to add another column here that i'm going to just assume some values of frequency from 1 to 9. so what i'm going to do is i'm going to now start editing again and then i'm going to create a field here and i'm going to call it i can call it frequency maybe frequency it's a whole number 10 then okay now i'm going to just autofill some numbers here from one to nine using an assumption i'm gonna i'm just gonna do them randomly so i'm going to be selecting maybe say uh maybe say 20 countries like this shift so i'm going to be selecting like these and then i say maybe for the first 34 countries that i've selected i'm going to give them a frequency of maybe one so i'm going to go and select here the frequency then i'm going to use quartz now again single quartz sorry single quartz then i'm going to put one for now i'm going to say only update there selected because i just wanted to update the selected ones with a frequency of maybe say one so i'm going to say update selected like that and you see it has updated this selected once so i'm going to actually repeat this process for the remaining rows so just i'm going to password here now that i've created this uh column of frequency with just my numbers that i did an assumption of this this is not really that actually it's just data that i'm going to use because of class purposes so we want to just say maybe this is the frequency of maybe say the movement of products from within these lines now so the next thing i'm going to do is i'm now going to do some little bit of symbology so that actually whatever i have created here now looks a little bit of a little bit better so i'm going to save and in my output line i'm going to now go to properties so under the properties we want to do a little bit of changes it's a single symbol so everything is actually just selected as a simple line like that so we want to do a little bit of change here so that you can actually look at the magnitude and first to be able to look at the magnitude you're going to look at the instead of a single symbol you're going to look at the graduated symbol then what value are you graduating so we're going to select the frequency so that the regions with the higher frequency will have a thicker line and the ones that have a lower frequency level or a smaller line so the next thing i'm going to do i'm going to just first leave these as a line then the format is the format then instead of the under the method here instead of the color i'm going to choose size so a point zero one size is a smaller is a is a smaller magnitude and a point and a two point two five uh a point two sizes of a bigger magnitude then i'm going to just come here and say equal interval and you can see it has already classified for me so the smaller regions have actually a very thin line and then the higher magnitude server take a line i'm going to leave the classes five i'm going to click on apply okay and you can now see we have them actually classified into that so i can actually even uncheck some of these and you can actually be able to see that the bigger the magnitude there actually the the thickness shows the magnitude of of the movement from my point of origin to my destination so you can see this can other destinations have a smaller uh frequency or migration so the next thing i'm going to do is instead of even using this i want to make it even a bit more interesting i want to now use instead of having them to just be symbolized to use arrows so i'm still going to go back to properties then now the symbol i'm going to actually now delete all then the symbol that i'm going to be using here again now instead of this just a simple line i'm actually going to uh select an arrow so i'm going to select the simple line then i'm going to select an arrow on the simulator type then i'm going to make sure that there is no repeat you see repeat arrows on each segment i'm going to uncheck that so it doesn't repeat the arrows then i'm going to also uncheck the curved arrows then okay then i'm going to now say apply oh sorry i'm going to actually classify them first here i can even change the cards i'm going to classify them then i'm going to say apply okay and you can now see they have the different arrows showing the movement so if i went back here and said under the properties of a simple arrow i want it to be carved a bit then okay then i'm going to delete all then reclassify them apply okay and now i have my cupped arrows very nicely carved showing the movement of whatever goods or anything within the different regions so that's it for today's exercise if you found this video useful and you want to learn more on qgis subscribe to my channel don't forget to give this video a thumbs up otherwise i'm just happy you're here see you in my next video
Info
Channel: WiseGIS
Views: 3,896
Rating: undefined out of 5
Keywords: qgis, qgis3, qgis tutorial, qgis 3.14 tutorial, qgis 3.10 tutorial, how to create flow maps in qgis, flow maps, gis, remote sensing
Id: bLz3qBqcIRM
Channel Id: undefined
Length: 23min 36sec (1416 seconds)
Published: Thu Dec 17 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.