Ki uta ki tai: 3D catchment models for public outreach

code
maps
animation
water quality
Author

Isaac Bain

Published

July 30, 2024

1 Introduction

Are you part of a catchment group or similar organisation and interested in creating a physical model of your catchment for public outreach? Allowing people to touch and hold a miniature version of the landscape can be a powerful community engagement tool. 3D printing is an excellent way to achieve this. But how do you get started?

Here are a few tips to help you begin, using open-source software and publicly available data. If you prefer, you can also contact me on LinkedIn or Twitter with details about your catchment and your goals, and I will generate an STL model file for you free of charge. You can then take this to your local library or another 3D printing service to print.

2 What is 3D printing?

3D printers are affordable, desktop machines that create physical objects from digital files by building up layers of material, such as plastic or resin. Most 3D printers use a process called Fused Deposition Modelling (FDM), where a plastic filament is melted and extruded through a nozzle to form the object.

For those concerned about environmental impact, the most common filament, PLA, is biodegradable and made from renewable resources like corn starch.

3D printers are widely available and can be purchased for a few hundred dollars.1 If you prefer not to buy one, many libraries2, universities3, schools4, and makerspaces5 offer 3D printing services for a nominal fee. Additionally, commercial services are available to print your models for you.6

3 Getting started

To create a 3D model of your catchment, you’ll need a Digital Elevation Model (DEM) of the area. A DEM is a 2D representation of the terrain, where each pixel represents the ground’s elevation at that point.

flowchart TD
    A[Get elevation data] -->|Large catchment| B[Global dataset]
    A -->|Small catchment| C[LiDAR]
    B --> D[Clip DEM to catchment boundary]
    C --> D
    D --> E[Build mesh]
    E -->|Determine Z scale, sizing, etc.| F[Convert to STL]
    F --> G[Send to 3D printer]

There are many sources for DEM data, but one of the best is the LINZ Data Service. LINZ provides free access to a range of spatial data, including DEMs, which you can download and use at no cost.

Once you have your DEM, you’ll need to convert it into a format suitable for 3D printing software. This typically involves converting the raster data into a mesh, which is a collection of vertices and faces defining the object’s shape.

Many tools are available for converting DEMs into 3D models, but one of the best is the rayshader package for R. Rayshader is an open-source package that allows you to create 3D visualisations of spatial data, including DEMs.

4 Mount Taranaki

Let’s start with an example of how to create a 3D model of Taranaki Maunga using rayshader. Although it’s not a catchment, it’s a beautiful landform and a great place to start.

We’ll use the plot_3d_vista function from the rayvista package to create a 3D model of Mount Taranaki. This function requires a latitude, longitude, radius (in meters), and a few other parameters to the model.

The function can also drape a satellite image over the model for a more realistic appearance. This isn’t needed for 3D printing, but it does enhance the model’s visual appeal for digital display.

Show libraries code
options(rgl.useNULL = TRUE)
rgl::setupKnitr(autoprint = TRUE)

library(rayshader) 
library(rayvista)
library(sf)
library(terra)
library(elevatr)
library(RColorBrewer)
library(leaflet)
Tip

The below model is interactive, you can click and drag to move it around.

Show the code
taranaki <- plot_3d_vista(lat = -39.295783, long = 174.06395,
                          radius = 7000, phi=30, outlier_filter=0.001,
                          fill_holes = TRUE, zscale = 40,
                          elevation_detail = 10, overlay_detail = 13, 
                          zoom = 0.6)

rgl::rglwidget(width = 800, height = 400)