Originally Posted in xyHt on 19th November, the original article can be read here
Last year I posted about this awesome plugin called “QGIS2Threejs” [here] and how it was possible to quickly render 3D visualisations for free using the open source GIS, QGIS. At the time I fudged some wind turbines as it was impossible to import models, furthermore I avoided too much detail as any imagery would look poor when zoomed in. In short, it was good but was not an alternative to ESRIs’ CityEngine or a model you could build in Blender.
A year and a half later, it’s a different story [demo here]
The wind turbine is a model I built in Sketchup and exported as a Collada file, the trees are created from Ordnance Surveys Open Map data (based on the woodland polygon), this is something which I could provide to a client to show how their issues interact with some confidence.
Below is a breakdown of the data and steps to reproduce it.
- QGIS 2.12
- Sketchup or Blender
- OS OpenMap
- Environment Agency Lidar DTM & DSM
Steps to reproduce:
- Open QGIS and import the OS data, style either with the QLR styles provided by Ordnance Survey or Ross McDonald personally, I created my own based on the Ordnance Survey style as it is instantly recognisable.
- Using QGIS, bring in the DSM and intersect the height with the buildings to add a z value to the buildings. I found that adding this height as a field was good for checking later on. Make sure that you use a mean height for the buildings so that you dont end up with strange shaped roofs.
- Using only the woodland layer of the OS OpenMap data convert to random points. Remember that your “average” tree is about 5m high and you want about 2m seperation (radius). The regular points tool can be found in the ‘Vector’ tab under ‘research tools’ – Don’t be tempted to use the ‘random points’ tool as it is quite tricky to set the density right for the varying polygon sizes. There is a tick box on the regular points so that some ‘randomness’ is generated.
- Create a new point shapefile, this will be used to provide a location for you turbine/model. Obviously, put the point(s) where you want your objects to be.
- Create or download your 3D objects. For this part, I made the turbine with Sketchup to the correct dimensions. The Sketchup 3D warehouse has a plethora of 3D models, cars, planes, a Back to the Future DeLorean….they can all be exported in Collada format from Sketchup, just ensure they are located correctly within the space – the model will render in reference to the point file you create, meaning that the point will be used as the models 0.0. You can also build models in Blender, AutoCAD or Threejs – As long as it is in Collada format, QGIS2Threejs can read it.
- Double up your trees! You need to have a trunk and a treetop, therefore, bring in the tree data again…..
- Open QGIS2Threejs, it should be under the ‘Web’ tab in QGIS, if you don’t have it there, go and add it as a plugin.
- Okay, now for the fun part. Whatever is currently shown in the dataframe, is what will be used as the imge overlaid on the terrain…so tidy it up and consider that the buildings, trees & model will be sat on top (Might be worth turning them off in the layers) Set your DEM to reference the DTM
- Here is where having 2 sets of trees comes in useful – set your first set of trees as cylinders (as above). Set a radius of around 0.5 (assuming you are using a metric projection). Then height to around 5-7m, I found that although the Institute of Architects recommend 7m, 6m worked well.
- For the second set of trees, set the oject type to sphere, radius of 2m and height the same as the trunk. DON’T forget to set the colour to green & the trunk to brown!
- Set the buildings to the ‘Extruded’ object type and set the Height (NOT THE Z COORDINATE) to the height field you generated, you can also use the object geometry, though I find the field method more reliable.
- Set a file/folder location and then sit back and enjoy!
But it’s no ESRI CityEngine…
True, this is not CityEngine, nor would it ever need to be. It is a FREE plugin for generating geographically correct 3D models…but what if I told you that you could add buildings with shape? There are companies like CyberCity3D who sell 3D buildings and cities, therefore you can bring in more accurate buildings….
One thing is for sure, this is a great little plugin, with a lot of potential.