This is a guest blog from Liam Mason, a spatial analyst with Marine Scotland. Some of his other data visualisations can be seen on his @marinemaps Twitter account or the Marine Scotland Maps portal maps.marine.gov.scot
[Edit: the tutorial was modified to use the GDAL-based DEM (Terrain Analysis) tools instead of Raster Terrain Analysis]
I love mapping bathymetric data in 3D. It’s almost magical, the ability to draw back the veil of the sea and reveal the mysterious landscapes below.
Yet, it’s remarkably simple to do using QGIS 2.8 or higher.
This tutorial uses one core and two additional plugins, which can be installed using Plugins > Manage and Install Plugins…
Firstly, ensure that GdalTools is installed and activated.
Secondly, search for qgis2threejs, and install.
Thirdly, search for and install quickmapservices which will give you access to a variety of basemaps.
Both of the latter plugins are available in the Web menu.
Lastly, you can further expand the basemaps available in QuickMapServices via Web > QuickMapServices > Settings > More services > Get contributed pack
This tutorial involves picking colours from the basemap.
The Windows version of QGIS has an integrated color picker tool, but for those of you using Mac OSX, Just Color Picker is an alternative (and free) colour picker tool available on the App store.
We’ll need a digital elevation model (DEM) which contains both bathymetric and terrestrial elevation data otherwise either the land or sea will be flat.
This tutorial uses the GEBCO 2014 gridded data:
Although the data is quite coarse at 30 arcseconds resolution, it’s suitable for 3D mapping at country-wide scale.
On GEBCO website, holding down the Shift key, click the left mouse button and drag to select the area for download.
Click to expand GEBCO_2014 Grid (30 arc-second interval). Tick INT16 GeoTIFF (data)
Scroll down and click Add data to basket. When the text on this button greys out, click View basket.
On the next site, select Check out your request.
If you don’t already have an account with BODC, you’ll need to register. Don’t worry though, it’s free and you won’t get spammed with emails.
Once registered, log in using your email and password. If you don’t want to supply a reason or funding information, simply type any character eg a space and Login to proceed.
Once logged in, you can Download the data.
Alternatively if you only want to map the undersea terrain, EMODnet (http://www.emodnet-bathymetry.eu/data-products) is a fantastic source of open bathymetry data, but you may need to merge the rasters.
(For the Firth of Forth image, I combined a licensed bathymetry product from OceanWise, with Ordnance Survey’s Panorama terrestrial product)
Loading and configuration
Firstly, use the Add raster button to load the GEBCO DEM.
Now we’ll drape a basemap imagery layer via QuickMapServices > ArcGIS Online > ArcGIS Online Imagery (options may vary depending on version of Contributed Pack)
[I had to use ESRI > ESRI Satellite. Ed.]
Set the Project Properties to EPSG:3857. (Pseudo/Spherical/Web Mercator, whatever you want to call it!)
This changes the project’s units to metres, which makes it easier to use the 3D plugin.
EPSG:3857 is the native projection for the basemap. Other metre-based projections can be used to reduce distortion, but other projections may reduce performance if transforming / projecting on-the-fly.
Creating the 3D viewer
Zoom and pan to the area of interest.
Load the qgis2threejs 3D plugin via Web > Qgis2threejs > Qgis2threejs
Change the template file to 3Dviewer.html (this reduces some of the tools in the resulting interactive map)
In World settings, enter an appropriate vertical exaggeration. In this tutorial, we want to exaggerate large undersea features, so we’ll use 40, but normally we’d use a smaller value.
(Note: if the project’s horizontal units are degrees, we’d need to use very small decimal values. That’s why we changed the project’s properties)
In DEM settings, ensure the GEBCO data is selected as the DEM Layer.
For the highest resolution output, slide the Resampling slider to the right and set the Resolution to 400% (these settings may need to adjusted depending on your computer’s performance).
Optionally, untick Build sides.
Finally, set an Output HTML file path and Run to start
It’ll take a moment to process, but the output HTML should load in your browser automatically. (In Internet Explorer 11, you may need to okay an error pop-up)
Voila! You have an interactive 3D model of the north Atlantic. Neat, huh?
Improving the bathymetry style (colours)
The imagery basemap in this tutorial includes bathymetric shading at smaller scales. We have more control if we create our own custom bathymetry style though. (The same tricks can be applied with for 2D mapping too)
Firstly, add another copy of the DEM using Add raster button, ensuring it’s positioned above the basemap in the table of contents.
Right-click the copy layer and select Properties
In Style, select Singleband pseudocolor as Render Type.
Set the Max to 0 and the Min to approximately the deepest point in the visible extent. We’ll use -2000 as an example.
Use the Add values manually button, double click on the value field for the resulting entry and enter -20.
Using a colour dropper tool, change the three colours to the lightest sea colour on the basemap. (If using high resolution aerial imagery, try to avoid sandy beaches)
Now adjust the colour for the deepest value (-2000 in example) by moving the V slider (value) to the left which will darken the colour.
For the shallowest depth (0), adjust the opacity to 0%. Values shallower than 20m now fade to transparent.
We now have a bathymetry colour scheme that works stylistically with the basemap.
We can experiment by changing the depth values. The shallower depth works best between -10 and -30. Changing the deeper value from -2000 to -1000 for example, the darker colour moves shallower.
Improving the bathymetry style (shading and texture)
Next we’ll improve the shading and texture.
Select Raster > Analysis > DEM (Terrain Models)…
Select DEM as Input file
Set an output file.
Ensure mode is Hillshade.
The example data stores height data in metres but uses degrees as horizontal units, so the Scale should be 111120. (See gdaldem guidance )
Tick Load into canvas when finished
Run tool using OK
When the hillshade layer loads, open the properties. Experiment with the Style settings for different effects.
I tend to pick Soft light for blending mode, with increased brightness and increased contrast.
The default min and max values are rarely suitable, I used 125 and 255 respectively. (HT to Ireland QGIS User Group)
The final improvement is to add a slope analysis via Raster > Analysis > DEM (Terrain Models)…
Similar prodecure to hillshade, but select Slope for Mode.
Again, Scale should be 111120 for tutorial data. Same guidance applies for slope as per hillshade
Once loaded, adjust the Style Properties of the slope layer so Color gradient is White to black.
Like the hillshade analysis, experiment with Min/Max, blending modes, brightness, contrast, and transparency.
The settings in screentshots above are used in the example below.
We now have a custom bathymetry style with improved shading and texture.
Finally, repeat the QGIS2threejs steps to create a 3D model using our custom bathymetric style.
Ta-da! Now have some fun and experiment with different basemaps!