Developing a 3D Model using QGIS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to another tutorial in this tutorial we are going to discuss how to do a bit of 3d modeling using QGIS to transform something that looks like this into something that looks like this so without further ado let's go ahead and get started with the tutorial alright so for this tutorial I'm going to be using three files I'll be using one raster which is basically a de M like this and I'll be using one watershed boundary and also I'll be using a river network so these are the three things that we will be actually using for this tutorial now for the time being I'll deactivate this river network and first of all let's go ahead and actually clip this DM into the boundaries of my watershed so to do that actually we can go to the processing toolbox now in case if you don't have the processing toolbox what you can do is you can go to the processing tab and over here you will see the toolbox option so just enable it and over here in the search panel just search and as you can see there are multiple options that you can choose from for clipping some comes from saga GIS and some from GDL and some from qjs itself I'm just going to go with this clip raster with polygons from saga and over here my input will be the de m and the polygon will be the boundary of the watershed alright now I can run after that you can go ahead and close this and after a while you will see that we have the clipped diem like this and next what I'm going to do is I'm actually going to play around with the colors a bit so after you open the properties you can actually go to single band pseudo color over here and over here from this color ramp I'm actually going to create a custom color ramp let's say we can go to create new color ramp and I'm going to choose gradient over here click OK I'm actually going to use maybe about three colors let's say for the lower elevations I can use something that might be of a shade of a blue something like this and I want to add a stop somewhere over here to add a stop you can just go ahead and double click somewhere in yeah and it'll add a stop a gradient stop so once you have a new gradient stop just click on that and go and try and select a color that's quite close to let's say something a bit of a brownish color something like this this probably would correspond to flat lands flat areas just to give the indication of those lands correspond to lower elevations all right and then maybe somewhere over here I'm going to add another gradient stop by double clicking and over here I'm just going to actually select a bit of a light green maybe from here you can choose a bit of a light green over here and at the final stop I can actually pick a bit of a dark green now this dark green will be reflected on areas such as the mountaintops so that's basically the idea that I'm having right now so let's click OK for and the mode I'm going to change it to quantile and I'm going to increase the number of classes maybe to about 15 classes let's say oh I think about 2/10 should be fine I guess and then click on apply yeah I guess the color distribution sort of more or less reflect the elevation ranges in the way that I would like to have it but if you would like to actually tweak the colors more you can just you can always play around more and you don't tweak the settings according to your preference but for me I think this is good enough all right now let's go to the 3d modeling pot now for this tutorial I'm going to actually rely on an external plug-in called QGIS to three.js in order to develop my 3d model now I don't have that plug-in installed already so what I'm going to do is I'm just going to go to plugins and go to manage and install plugins first and over here we can search for that plug-in QGIS to three.js you can see that already here and once you locate that you can simply install that from here just click on install plug-in and just make sure that you are connected to internet so that it can download the corresponding data and install the plug-in for you guys alright once you're done with that you can just go to web and you can see that there is a new option called qg is - 3 j s now before going to this QJ is - 3 j s exporter I'm just going to actually go ahead to my coordinate reference system over here and right now I'm using WGS 1984 geographic coordinate reference system and the unit of WGS 1984 geographic coordinate reference system is actually decimal degree however I would like to have my data frame in a projected coordinate system so that I can work with units like meters so since I'm working with an area which corresponds to Malaysia I'm actually going to select the corresponding UTM zone in this case it's going to be UTM zone 47 n but in your respective case you can actually find out to which UTM zone your corresponding area belongs and then you can actually change to that particular UTM zone and once I select that I can simply go ahead and click on apply and then okay and then I'm going to go to web select the newly installed plug-in QGIS to three J's and open Q J is to three j s exporter all right now once you open this exporter window you will see you will not actually see anything until you click on this diem and as you can see now the de M appears but not necessarily in a 3d way but to build a proper 3d model from here we are going to actually have to do a couple of things now the first thing is I'm going to remove this external parts we don't need those necessarily so what I can do is I can go to this DM option right click over here and go to properties and from here there are actually a couple of options that you can play around with now if you would like to increase the resampling level what you can do is let's say you can put it up to about five and see how it looks after you click on apply but for my case I I would actually like to maybe retain the resampling level to about three and the most important thing when it comes to removing this external parts is that you can select this clip DM with polygon layer just make sure that you have imported a corresponding polygon layer by which you would actually like to demarcate your boundary now in my case I have already imported this watershed boundary shapefile and that's going to be my polygon layer which is going to act as the boundary by which the DM is going to get clipped for this particular 3d model and the other options that you can play around with is actually the resolution let's say you can you can decrease or increase the resolution but in my case I'm just going to retain the highest solution that we have yeah I think that's about it so I can just go ahead and click on apply and once you do that this might actually take a while a few seconds at least for the program to build the 3d model and you can click OK all right now you see actually we start having science of having a proper 3d model isn't it now to zoom in or zoom out you can use your mouse wheel if you scroll up you will see that you will zoom in and if you scroll down you will see that you will zoom out and to move this in space you can use the right mouse button you can press on the right mouse button but don't let it go and you can now move your mouse around and you will see that you can actually move the whole model to a location of your of your preference and if you would like to rotate this along a particular axis what you can do is you can just move the mouse button and pick a point around which you would like to sort of pivot this whole model let's say if I go somewhere in the middle and if I click once left click once you will see that a yellow color button appears and now what you can do is you can just come somewhere over here and then if you move your mouse around while you hold your left click you can see that you are sort of pivoting the whole 3d model around that particular point that you specified so that's how you actually sort of pivot the model the whole model and the next thing that I'm going to do is I'm actually going to increase the vertical exaggeration so so that'll sort of artificially build up the model based on the Z value of each of these pixels of this DM now to do that you can go to the scene and go you can go to scene settings and over here you can vertically exaggerate the Z values let's say if I put maybe a value of odd let's say 2.5 or something and if you press apply it might take a while to build rebuild the DM you can see that now actually the mountains and the lowlands are quite easily distinguishable isn't it now one more thing you can do is you can actually add the river network to this so what I'm gonna do is I'm going to first activate this river network shape file which is made out of polylines and you can see that the lines already appear over here but I'm going to change the color let's say if I go to properties and and now just keep in mind that you can actually access the layers individually even though you have already opened this qg q JS 2 3 j s exporter so you don't have to necessarily close this and then come back and then open the exporter again you can actually see multi Annesley work on your layers while you keep this one open so I'm just going to select this simple line and change the line color to well since it's a river I think it's better to go with something that's reflective of of a shade of a blue something like this yeah and then I can click apply and click OK now you can see that actually the river starts running from the mountaintops and then flows down all the way to the lowlands in case if you would like to do a couple of advanced visualizations corresponding to this line shape file what you can do is you can first activate this line over here and then go to properties and from here actually there are a couple of things that you can just try out for example you can change the object type from line to be something else let's say something like if I set the object type to be wall and over here the z-coordinate I'm going to say relatively relative to the DM layer and over here I'm going to maybe increase the altitude to be about I'm not sure let's say about 50 and see what happens and over here you can see that it's saying it's building the river network yeah it's not so obvious I'm not sure if you can notice or not maybe if I put something about 250 I think it might be a bit obvious yeah you can see that when I select the object type to be wall it's sort of the river network which used to be a line sort of builds up as a wall now I'm not I can't think of a case where this might be handy but but in case if you might need this kind of an effect for certain type of visualization it's better to know that you can actually do something like this using this 3d model builder so to me actually it looks quite nice I mean it's it's a pretty cool trick that you can do to make your model a bit more visually pleasing wherever it becomes relevant so I'm just going to actually keep this with an elevation value of 100 now as you can see there are a few other things that you can actually try out and see how you can alter this 3d model to fit to fit the model to your specific purposes but I guess you got the basic idea of how to use this tool how to use this external plugin of QJ is to develop a 3d model to you know sort of do a quick visualization of a digital elevation model that you might have now before I wrap up this tutorial I would also like to explain to you a way that we can use this 3d model and export it to an external file so that we can actually pass it on to someone else who might not necessarily have qgis but still can weave this 3d model just the way that we are weaving it like this so the way that you can do that would be so we can go to file and go to export to web and from here you can actually export this into an HTML file so that anybody who has a web browser actually can beat this without necessarily having to have qgis so the output directory let's say like I have created a folder called creating a 3d model using QGIS so I'm going to select that folder and I can rename this to be something like 3d model of the watershed dot HTML I'm going to unpick open the viewer in a web browser and also before you export the file just make sure to take this enable the we were to run locally under these general settings and you can click on export you can see that I actually do have my other shape files and stuff over here but among those you will see that there will be a couple of new files which gets generated and along with that we have the HTML the corresponding HTML file which we also generated 3d model of the watershed now I can click on that we get a complete view of the 3d model just as how it was within QGIS but now we are not actually running qjs at all we are opening this just using the Firefox web browser so pretty cool isn't it now you can just as easily pass all these files to maybe someone else who might not necessarily have QGIS and still that person would be able to open this using their own local web browser which can turn out to be actually quite useful in certain cases all right I guess that's about it for this tutorial so thanks a lot for watching guys and don't forget to subscribe for more tutorials like this and I'll see you with the next tutorial soon
Info
Channel: GeoDelta Labs
Views: 34,454
Rating: 4.9675851 out of 5
Keywords: QGIS, 3D, Qgis2threejs, modelling, modeling, javascript, HTML, how to, develop, using, vertical exaggeration
Id: WmobNBnN1lc
Channel Id: undefined
Length: 13min 19sec (799 seconds)
Published: Thu Jun 18 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.