Update: If you‘re interested in a guide to 3D visualisation in new QGIS 3.0, check this text.
If you’re looking for information specifically about displaying 3D buildings in QGIS, follow this link.
Some time ago I found a text with a tutorial how to use QGIS plugin, Qgis2threejs. The QGIS tool allowing to view 3D objects in a web browser interested me enough that I decided to try it out. To create a 3D map with this plugin, you need only terrain data. Optionally, the 3D surface can be overlaid with map image or vector data. In this text, I want to share my workflow and results I got. When creating my own 3D maps, I chose to focus on two areas, California region and Rome.
Obtaining the data
First of all, you will need elevation data. There are a few great online sources to find free raster DEMs. For this project, I’ve used U.S. Geological Survey’s EarthExplorer (you can download for example SRTM and Aster digital topographic data from there). In case you look for DEMs on a local level, most land survey organisations, like National Land Survey of Finland open data download service, offer free, open geographic data.
With Qgis2threejs plugin, it is possible to include in your 3D map points, lines and polygons. If you need e.g. roads or land use shapefiles, check free OpenStreetMap data. I chose to overlay elevation data also with some old printed maps. Again, NLS service provides very useful data. From this website, you can download old basic and topographic maps for free. Other great sites worth checking are David Rumsey Map Collection and Mapster.
California 3D topography
I wanted to start with something easy, so I decided to use only elevation data first. In EarthExplorer, I found ASTER global dem data from California region and downloaded them. The area I wanted to portray lied on six different blocks, so I created Virtual Raster to have only one file. In raster properties under Style tab, I changed Render type to Singleband pseudocolor.
Next, from Web menu, I opened Qgis2threejs plugin. In DEM settings, I set Dem layer to virtual raster I built and enabled clipping DEM with polygon layer that marked the extent of the area. For Display type, I left default Map canvas image. In World settings, I tested different values for Vertical exaggeration and finally set it to 5.
Since the plugin allows to add vector data to 3D map as well, I downloaded OpenStreetMap dataset for my region. I decided to add major roads and city locations to my map. In Point and Line settings of Qgis2threejs plugin, I selected appropriate layers. After trying different styles for vector data and adding labels with city names, my 3D map was finally ready.
Rome old topographic map in 3D
Next, I tested how a DEM with an overlaid map will look. As I mentioned, there are many sites sharing old maps in digital format, so obtaining one shouldn’t be a problem. However, most often the maps are not georeferenced. If the chosen map lacks coordinate information, QGIS can’t properly place it on top of elevation layer. It is still possible to use such maps, as long as they are georeferenced first.
Georeferencing a map
Georeferencing in QGIS is done with Georeferencer plugin. This tool will generate world file for the raster map you want to use. In David Rumsey Map Collection I found a topographic map of Rome from 1870 and decided to use it for this tutorial. I also had to georeference my map before creating a 3D map. First, I added OpenStreetMap basemap to QGIS project. Then, in Georeferencer, I opened Rome map and just clicked in a specific point. When a dialog box appeared, I selected From map canvas option. Next, I clicked on the same point on OSM map in main QGIS window and choose Ok. When georeferencing a map, I suggest to use at least 4 reference points and choose only points that are easily detectable on both maps and which location haven’t changed throughout the years.
When I had a georeferenced map, I opened Qgis2threejs plugin and selected appropriate DEM layer. I left default Map canvas image option selected and chose 400% resolution. Again, I clipped DEM with map extent polygon. This time I set Vertical exaggeration to 2 and clicked Run. Below you can find the result I got.