Heat maps in QGIS # Lesson 18 of 29 # QGIS Tutorial.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] so hi guys welcome to today's qgis tutorial lesson 18. in this video we'll learn how to create heat 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 video if you are new to my channel you can follow all my previous lessons and useful gis tips from the links in the descriptions below let's get started so creating heat maps a heat map is a data visualization technique that shows magnitude of a phenomenon as color in two dimensions the variation in color may be hue or intensity giving obvious visual clues to the reader about how that phenomenon is clustered or varies over space hitmaps are most commonly used to visualize crime incidences traffic incidences housing density among others so let's go to qgis and see how we can create heat maps using uh point data that you have downloaded for this exercise so we'll open a qgis and we'll select new project and have a new blank project the data that you're going to use in this exercise is some data i downloaded from our u.s website it's about crime data in a region in baltimore so the data that i downloaded was in csv format but i converted it into shapefile and that is what you're going to be using in this exercise if you don't know how to convert your data from csv to to a shape file or from an excel to share file then you can follow lesson six and i'm going to make sure that i put the link in the description below so that you can learn the process that i use to get my share file otherwise let's just go directly to where our data is i'm going to load a vector layer layer i'm going to go to layer i'm going to add layer add vector layer and i'm going to browse for where my vector layer is it's in on the desktop in the gis folder data then the us i'm going to look for the u.s and i have baltimore crime incidences so i'm just going to load the baltimore crime incidences it's a point data and click on add and it's been added so i'm going to click on close and i have my data here loaded so the first thing you're going to do is you're going to look at the attribute table to see what kind of information this layer has so i'm going to click on open attribute table and it will bring us the attribute table all the information about this layer and you can see there is a kind of weapon that was being used in these incidences the crime called the crime date the crime time the location the description the post the district and all that so now that we understand that what what our data is all about they just point data of incidences of crime in this region so how do we get a heat map out of these the first thing you can just do is you can right click on your layer go to properties then go to symbology then by default it is under single symbol but we're going to now change change it so you click on this drop down here and then we're good we've actually been learning how to use the categorized graduated rule but now we're going to select the heat maps so select heat map and then the color ramp what color do you want to use normally by default is there just the gray the gray color ram but we're going to use a different color ram so that you can actually see a difference so i'm going to use the reds then i'm going to just leave the radius at 10 i'll explain something later on here then the maximum value i leave it as automatic the weighted points we have we actually don't have any any column that has the weighted points so and then i'm just going to leave everything as it is right now by default and click on apply then okay my layer will disappear a bit and then after a few seconds it will appear and you can see the process is running down here and now we have a very very nice heat map of this area so the next thing i want to do is i want to bring in a a layer here so i'm going to go to htm so i'm going to bring a base map here i'm going to use google maps then i'm going to bring the google maps below the crime incident but you see it is actually being covered everything is actually being covered by the baltimore crime incident so what i'm going to do is i'm going to just change a little bit of styles here so i'm going to go to properties again still under this page here i'm going to select the layer rendering so that i'm able to change the opacity so i'm just going to change the opacity from 100 to maybe say half of which is 50 then i click on apply okay give it a few seconds to load and you'll now see the crime incident says now the heat map is well displayed showing some regions when i'm zooming in like regions here in the ellwood park a lot of crime incidences here then there's some also a lot of crime incidences here in parkins home then you can see the difference in the different regions this is always good for visualization because then you can just be able to visualize very quickly and just see which regions have more incidences than other depending on the number of incidences that are appearing within that region but now if we want to have a permanent layer and a layer that you can actually even share with your colleagues in the office or maybe say share it somewhere else you need to have a permanent layer so how do we get this permanent layer so to get a more permanent layer what we need to do is we now need to go to the processing toolbox select processing toolbox then under the processing toolbox you can actually search for heat maps or you can just come down to interpolation here then under interpolation you can see there is a heat map which is nail density estimation so i'm going to select heat maps whenever clicking on it then you can see it is requiring some information from you so the first thing you look at is there you will actually load their private scenarios but then when you come down here under the radius it is telling you that this data actually is in decimal degrees which means that this is a geographic coordinate system so we need to change it to more a more measurable project predict projection which is a utm so what i'm going to do because you can see now it's now telling me giving me a warning signing and telling me that actually this data is in degrees so i want to do something uh some little bit of changes so what i'm going to do is i'm going to reproject my data to utm so how do we reproject the data so i'm just i'm just going to click on the close button here then under my processing toolbox still i look for read projecting and you can see there is a project layer here right so i'm going to select or you can go to vector general and see the project layer here so i'm just going to select the project layer from this and it will give me the input layers the baltimore which is in geographic coordinate system then the target crs which is the projection i want to change it from a geographic projection to a utm which is more manageable so for this region it's in the u.s i ascertain that it is under the utm zone 18 north you can actually search for your utm zone here so for my case i'm using the utm zone 18 north and you can see utm zone 18 note is actually our region is actually here and it falls in between within the atms on it in north i'm going to leave everything as it is and then i'm going to make sure that the projector is just a temporary layer i'm going to click on run and you can see it has finished projecting so i can click on close and i have my new layer that is reprojected when i open the properties and i look at the information now information i have a reprojected layer and you can see the crs now is reprojected to utm zone 19 so let's now go back to our toolbox here and select the interpolation then select heat map and now you can see the warning sign has gone and it's telling me that now it has selected there the projected if i select the baltimore the previous you can see it is giving me still this uh warning sign here but i want to use now the projected so for you to avoid trying to maybe say convert one degree to it's uh it's always one degree to 111 kilometers which is not uh really ideal just use the project your layers first and then you can now use them easily so what radius do i want to give it i want to give it a radius of maybe say a thousand meters which is one kilometer then the pixel size i will put it at maybe say 50 50 by 50. which is okay then the radius from the field is optional all these other things are optional the claire shape actually you have so many options here you can actually experiment but for this you're going to use the quadratic then i'm going to leave everything else as it is then i'm just going to save a temporary layer which is a heat map and i'm going to click on run and it's processing give it a few minutes to process and the process has finished you can see you have a heat map here and click on close and now we have a very very nice heat map here but it looks it doesn't look so good you can see there's the dark regions of the white but we can actually style it again so i'm going to right click on on the layer that i have the permanent layer that i now have the raster layer i'm going to go to symbology instead of a single band gray color i'm going to select single band pseudo color and you see by default it takes the red color ramp so i'm going to click on classify and it has classified my values i'm going to click on apply okay and you now have your heat map here again if i wanted to now see whatever was underneath i just still go back to the properties then i can now change the transparency and select transparency and instead of having hundred i'll select maybe say 50 then i click on apply okay and i have a more permanently i'm just going to just uncheck this point data so that i remain with my heat map here and my google maps as the base map and you can see now this region in tailwood park and downtown actually have more crime incidences including the inner harbor have more so the next thing we are going to be learning is now uh how to now use that weight option when you want certain crime incidences to have more consideration than others we're going to now introduce a formula so that we can have a certain column that shows the weight proportion of all these incidences so i'm going to just open the attribute table of uh this is reprojected now this is what this is the layer that you're actually using so i'm going to open the attribute table and you will see you actually have all the crime incidences but now here under the weapon you want to say maybe uh firearms is a more serious crime than maybe say others in hand and so we're going to just say firearm is a more uh so it's actually it's actually given a bigger threshold of consideration than maybe save someone who was maybe attacked using hand so let's now learn how to introduce here a new column called weight so to introduce a new column here called weight so that uh like for example if you want to classify if you want to if you want to run a heat map here like when i go to properties and then i go to symbology and then i go to heat maps and then i select my red color nice color amp here then i leave my radius to 10 then everything here automatic maximum value automatically there is a weighted point by so we want to now have a wait point class here so how do we do that what you'll do is go to the same layer right click open attribute table then we need to create a new column here so we are going to go to the open field calculator under the open filter actually going to create a virtual field so i'm going to select create virtual field and this virtual fields name will be wait and it will be an integer position 10 to 3. now we want to now input here our formula and see how we can actually be able to now give the different kinds of incidences the different ways so what you're going to do is now first you're going to go to conditional then select case then under the case i can enter and i'm going to now put my formula here so i'm going to put my code here and say when then the kind of weapon now i go to fields and values and i'll say when the weapon like and i'll select for all unique weapons that i have i'll select the firearm which is now having the higher threshold firearm then i'll give it a value of 10. so this is the highest uh threshold that i want to give so you can actually copy the same formula now because you have several other kinds of weapons used so i'm going to paste it here and then now the the only thing that i'm going to now change is the kind of weapon and there the threshold that i'm going to give it so for this case i'm going to give now the the knife which is now a more serious incident also i'm just going to delete these then i write knife then the knife will be given a threshold of five then i'm going to also just do the same thing for the third kind of weapon that i want to also classify so i'm going to just give it maybe say three or two let's give it two and then that is the kind of weapon is the hand hands so we only remain with one option here which is the else so the else i'll just say one and then i'm going to end my formula here and you can see my formula is very very okay now the only thing i'm remaining to do is i'm just going to click on ok so that i apply my formula which is perfect here into our attribute table and the column that will be created is called weights which is a whole number and i'm giving it a position okay so it's just going to create a virtual field so i'm just going to click on ok and it's computing my table and you can now see we have a column called weights here so let's go back to our layer now that we have these uh created here in our projected layer i'm just going to click close it and then i'm just going to uncheck the heat map here now we want to create a hitman putting into consideration the weight so what we'll do is we'll go to our search button here and look for heat maps or we can just go to interpolation then we're going to select heat maps then we're still using the reproject tab the radius you're going to put it at still 1000 we want to just see the difference of these we're going to put everything the same as the first layer which is 50 then the weight from field now here we're going to select weights remember in the other one we didn't have the weight so we just let everything be at default but now we are gonna we are going to select the weight then the nail shape is just remaining the same and everything is just going to remain the same so we're just going to click on run so that we have our second heat map that now has the weight as part of a consideration so we have our hitman our heat map created again so i'm just going to click on close and then now i'm going to style my heat map here so i'm going to go to properties my new heat map symbology see the color i'm just going to use the same colors the red i'm going to click on classify and click on apply okay and now we have our new heat map i'm also going to go to properties of the same and make sure that the transparency is at 50 and click on apply okay and now we have our heat our initial heat map here and our new heat map here so you just want to see the difference between the two heat maps so i'll remove this uh layer here and then you can actually see not there's some difference between there too and these are these as a result of uh now these other than the other heat map having that threshold for the weight so that is how we actually create heat maps in qgif and put all those considerations into place if you found this video useful and you want to learn more on gis subscribe to my channel hit the bell icon so that you can get a notification when i upload the next lesson otherwise i'm just happy you're here see you in the next video
Info
Channel: WiseGIS
Views: 776
Rating: undefined out of 5
Keywords: qgis, qgis3.14, up and running with qgis, how to instal qgis, foss, open data, open source software, baltimore, gis, remote sensing, heatmaps, hotspot analysis, kernel density, utm, reprojecting, how to create heat map in qgis, how to create heat map in arcgis, qgis 3, qgis tutorial for beginners, qgis tutorial, qgis3, raster data
Id: r3cVofPdrTI
Channel Id: undefined
Length: 21min 1sec (1261 seconds)
Published: Mon Sep 28 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.