QGIS User 0027 - Styling Contour Lines

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this episode I'm going to show you how you can convert raster elevation data into nicely styled contour lines [Music] to do this I will use a simple elevation data set in a raster format it's a pre active data set so I don't have to worry about this Z vector and so on so this will be pretty straightforward first of all I need to create my contour lines and I go to restaurant contour and depending on the area there and so on you can do some different settings and it also depends on the scale your intent in terms of used the contour lines for I will have five meters interval and everything else will be the default and for this example I will not bother creating a permanent layer so it will be just a temporary layer there we go and let's go to an area with a few lines like this and I'll turn that one off first of all I need to pick a color and to do that I open the styling panel and I think I will go for a darker Brown maybe like that and a size what happens if we take really thin one okay that could be good good to start with but I will use expression to control the thickness because I want the lines to have different thickness depending on the elevation so first of all I will test if the let's see was it elevation 11 11 and this is a small trick I will not test for every even 100 meters I will test for all even 100 meters and to do that I will use the ampersand which divides by 100 but it doesn't give me the division result it gives me the what you call it what's left over from the division so if it is evenly divided by 100 the result will be 0 so if it is divided by 100 I want this line to be here let's say 0.8 and if it is not dividable by 100 I want to also test if this dividable work by 25 so if allowed amazon's 25 equals 0 and then the line thickness should be 0.5 and otherwise Oh point point and otherwise it should be zero point one so let's close off all those parentheses and test it okay I don't see a lot of difference between zero point eight and zero point five so let's make that a big difference say point three and six I think that's better so if I only want the lines and I'm done this is it elevation our contour lines made simple with the qgs but I also want to have labels so I will have the elevation value and I add em afterwards that will give me the elevation and an indication that this is meter values I will also change the color let's make it the same color so pick no copy copy that color and paste it like that and font let's make it so you can see it we need to have it ah maybe leave it as regular for now placement I want it Kurt I want it on the line like that and I also want to use masks so enable masking like that now I need to reduce the number of labels I only want to label the even 25-meter contour lines so in the expression I will use similar expert expression as before if a lab 10% twenty five equals zero then I will print the labels otherwise the label will be empty I got a lot fewer labels I do want it to be more than one label for each line at least the long ones so I think that was repeat and let's say how many millimeters hundred too much 150 yeah that's okay next what's next yeah if you want to create cut cartography correct no cartographic correct labels they should be facing uphill so if I turn this layer on let's just make it a pseudo color that's and [Music] use CPT City and top or graphic that one like that so this area is higher and these are lower so all the labels should be facing upwards and they are not right here you see 175 metres is pointing down I need to fix that go back to contour lines labels and you're under the render tab we can choose to show upside-down labels and now it's set to never but if we set it to always nothing will change I don't know why I think it should change but we can fix that as well well it did change now every label is pointing down in not up yeah that's it so if I said never everything should be pointing but it doesn't but always then we force it to always be upside down and that means I need to turn the line reverse the line so it faces the other way and we do that with a geometry generator make the line string and then we will use the geometry but it should be reverse like that now all labels are facing uphill which should be cut graphically correct there are a few more things you can do to make it even nicer looking and for that we change from simple line to geometry generator select a line string and the first thing is to remove all these really small polygons if you look at the rest earth there are areas that may not be that relevant so we start with an if statement if length is more than let's say 400 meters then we show the geometry otherwise we show nothing then we can play with this number so if I say 100 we have some small ones if I say a thousand maybe a bit too much so I think 400 was actually pretty good also when we have filtered this out we can use a smooth function on the polygons like that it will make them a bit more curvy but not exaggerated to the extreme if you want it to be even more smooth you can add a number here that will smooth it out even further but it will also be a lot slower so I think it's enough to use the default now I need to set the color back to brown and I need to set the thickness let's see the recent ones like that so now we have a map with nice smooth lines they are oriented the labels are oriented the right way if I just put it back to 100% and we can save this style as lay a definition file or cubies lay a style file I should say and use that repeatedly for this type of data if you have contour line data it's not certain you can use this method because when we create the contour lines with Yogi's it will orient the line direction the same way for every every line if you have data from a third party or somewhere else that's not certain so try it and if the labels are upside-down you can use this reverse function for the labels in the geometry generator here so activate the geometry generator and reverse the geometry see you next time [Music] [Applause] [Music] [Applause] [Music] you
Info
Channel: Klas Karlsson
Views: 14,671
Rating: 4.9733925 out of 5
Keywords: QGIS, Elevation, Contour lines
Id: -xzoVF7Z7u0
Channel Id: undefined
Length: 15min 30sec (930 seconds)
Published: Tue Apr 14 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.