Let’s start using Qgis2threejs plugin!
Installing the plugin¶
Open the QGIS plugin dialog (
Plugins > Manage and install plugins...),
and then install Qgis2threejs plugin.
Need help? See the 10.1.2. Installing New Plugins section of the QGIS training manual.
Obtaining elevation data¶
If you already have raster DEM data, you can skip this step.
NASA released elevation data generated from NASA’s Shuttle Radar Topography Mission digital topographic data. We can use the data freely. Elevation data version 2.1 can be downloaded from the distribution site.
Download a zip file that contains elevation data of the area you are
interested in from under the
version2_1/SRTM3 directory. The zip
file contains a
.hgt file, which is readable by the GDAL.
If the area extends over two or more files, you might want to create a virtual mosaic using Build Virtual Raster (Catalog) tool of GdalTools.
Do you have time to explore new high-resolution SRTM elevation data? You can download 1 arc-second SRTM data from the EarthExplorer (User registration and login are required).
Loading DEM data¶
Drag & drop the downloaded zip file to QGIS window
(or load the file using
Add Raster Layer dialog).
You don’t have to unzip it.
Horizontal unit of SRTM data is degree, whereas vertical unit is meter. For appropriate visualization, you need to transform the DEM data to a projected CRS. QGIS can perform the CRS transformation on the fly.
So, let’s enable the On The Fly CRS transformation and change the map CRS to a projected CRS.
Click the CRS status icon in the bottom-right corner of the window to
open the project properties dialog. Activate the
Enable 'on the fly' CRS
transformation checkbox and then select a suitable CRS for the DEM extent.
If you don’t know which CRS is best suited, select the Spherical Mercator projection
EPSG:3857), which is adopted by many web maps.
In the Spherical Mercator projection, size of every feature is horizontally larger than actual size except features on the equator. At latitude 40 degrees it is enlarged 1.3 times, at 60 degrees enlarged twice.
Open the raster properties dialog for the DEM layer and colorize the DEM layer richly.
An example (
Singleband pseudocolor render type and inverted
BrBG color map):
Zoom to a part of the DEM layer extent as the map canvas is filled by the colorized DEM.
Click the plugin icon in the web toolbar.
Run button in the dialog.
3D terrain appears in your web browser!
If you want to hide the dat-gui controls box at the top-right corner, press
Tutorial is over. Now, you know 3D visualization with QGIS is very easy. If you can use high-quality data, you can create beautiful 3D scenes!
Next, how about adding a background map layer to the map canvas. You can do it easily with QuickMapServices plugin. Also, how about adding vector data to the scene. Object Types page has example images of various object types. See Export Settings for the detail.
You can publish the exported scene just by uploading the exported files to a web server.
Please do not forget to ensure that you comply with the Terms and use for the data before publishing the scene to the web.