It has now been possible to create 3D models in QGIS for several months using the QGIS2ThreeJS plugin. I have seen several nice maps that came out of this plugin:
This plugin is perfect for me, as I have little coding experience, and this plugin requires absolutely none of it. For a step-by-step guide of how to make a map using this plugin, view the great blog of Anita Graser.
I tried to use the plugin in a slightly different way, as I don’t use it for topographical purposes but for a more abstract purpose. I wondered if it was able to population density in the Netherlands in an original way, not using points or polygons but using lines (and 3D obviously). Here is my thought process/steps:
I used CBS data (Dutch statistical agency) as they have pretty detailed data regarding real estate values in the Netherlands. This data is available as 500x500meter polygons.
I first tried to simply plot these squares using the population density as the height of the Z axis. However since there are a lot (151108) 500×500 meter squares making up the Netherlands I quickly ran into performance issues. Inspired by James Cheshires Population Line map, I wanted to visualize using lines.
2. Manipulating data
As mentioned before I wanted to go from polygons to lines. However this is easier said than done. I wanted horizontal lines, however at first I was stumped on how to generate them from polygons… I first started to make centroids from the polygons, which is easy enough in QGIS.
I then thought of something, if I want to connect the dots in a horizontal line they will all have the same latitude value. Following this I calculated this value in a new field using the field calculator and then used the point to line function to connect the dots to form 1 line using the latitude value as the binding attribute.
So now I had my lines, 626 of them to be exact, however they looked nothing like the Netherlands as the lines simply connected through water to form a uniform blob of lines. So I clipped the lines using a layer of the Netherlands which solved the problem and produced a nice sharp layer.
However I still needed to gives these lines a z value. Luckily the threeJS plugin supports multiple layers, so I simply created a DEM from the original centroid layer I created earlier! I used the number of people per 500×500 meter square as the height value which resulted in a DEM (generated using the QGIS toolbox, GRASS interpolate plugin).
3. Final product
So to recap, we went from polygons to points, from points to lines, from lines without height value, to lines on top of DEM.
This results in the following output:
Investigate the model by clicking on the picture (Controls: Left mouse button : Rotate, Middle mouse button : Zoom, Right mouse button : Pan).
You will see a landscape which just looks like a bunch of lines from above but once you pan and zoom you will find that it is a landscape including height.
You will see the huge population density in Amsterdam and the ‘flat plains’ in the Dutch countryside. Be advised though, the model uses a lot RAM, and is quite a large file, so it might take a while to load.
I hope you found this blog interesting, have fun exploring the plugin for yourself. Feel free to ask any questions!