Making a high-resolution 3D map of the Geldingadalsgos volcanic eruption

Maps

Open data and open-source tools combine to make a detailed model of Iceland’s newest land

The spectacular and 'very well behaved' volcano on Fagradalsfjall as it was on the 26th of June 2021. See the full-screen interactive map.

On the 19th of March 2021 Iceland got a welcome distraction from the tedium of the Covid pandemic in the form of a volcanic eruption. It was virtually the perfect tourist volcano: it was easy to get to from the capital city of Reykjavík — but not close enough to any urban area to be a danger to life — there was no ash cloud clogging the sky, and, according to Einat Lev, professor of volcanology at Columbia University, the volcano itself was ‘very well behaved’. It was an easy hike you could do in an afternoon. People flocked there in their thousands.

This wasn’t just good for tourists. Landmælingar Íslands (LMÍ), the national land survey of Iceland, regularly surveyed the eruption from an aeroplane, flying overhead and taking high-resolution photos of the ground. This allowed them to map the area, measure the spread and thickness of the new lava, and track the speed it was flowing from the crater. LMÍ also used stereophotogrammetry to create a digital elevation model of the area. A pair of images, taken at different positions, can be used to estimate the three-dimensional shape of a an object — like a volcano, for example. To my great delight, LMÍ have made the results available in a scientific paper1, published their many elevation models, and created a WMS web service for the aerial imagery.

I discovered all this at about the same time as MapLibre GL JS, the open-source web mapping library, announced its support for 3D terrain. That made me think: I wonder if I could make something from all of this? And so, after a few evenings of data wrangling, I made a 3D map of the Fagradalsfjall volcanic eruption as it was on the 26th of June 2021. Exactly one year ago today. You can see it above or you can play around with the full-screen map.

It’s come out quite nicely, I think, but it wasn’t quite as easy as I’d hoped. (It never is.) There was a fair bit of trial and error involved in stitching the digital elevation model (DEM) TIFFs together and I helped get a patch into MapLibre that was needed for the 3D terrain to work correctly. A large part of the work was converting the stitched DEM into TerrainRGB tiles — Syncpoint have an excellent how-to guide if you ever need to do the same. Using GDAL, Rasterio, and rio-rgbify it went roughly like this:

# Combine all the DEMs from the time of the eruption (https://zenodo.org/record/6598466)
gdalwarp DEM_preeruption_IslandsDEMv0_2x2m_isn93_zmae_Pedersen_etal2022.tif DEM_20210320_0745_HEL_2x2m_isn93_zmae_Pedersen_etal2022.tif [... + 29 more] combined_dem.tif
# Transform from EPSG:3057 to EPSG:3857 (cropping to bbox.geojson while we're at it)
gdalwarp -t_srs EPSG:3857 -r cubicspline -overwrite -dstnodata None -co TILED=YES -co COMPRESS=DEFLATE -co BIGTIFF=IF_NEEDED -cutline bbox.geojson -crop_to_cutline combined_dem.tif combined_dem_3857.tif
# Convert the combined DEM to TerrainRGB
rio rgbify -b -10000 -i 0.1 combined_dem_3857.tif combined_terrainrgb.tif
# Create TerrainRGB tiles for MapLibre
gdal2tiles.py --zoom=10-18 --tilesize 512 --webviewer none --resampling=near --processes=8 --xyz --exclude combined_terrainrgb.tif tiles

Then I used MBUtil to store all the TerrainRGB tiles as a single MBTiles archive, and then I converted that to a PMTiles archive to make it easier to serve from Amazon S3. This was all just for the 3D terrain tiles; I had plans to host a copy of the aerial imagery myself, but I haven’t yet managed to make a high-res tileset. Instead, I’ve used Landmælingar Íslands’s WMS API directly.

After that, a little bit of Preact for the front-end and I had myself a map of the volcano. It was then that I finally contracted Covid. That really gave everything a 2021 vibe.