# libraries ---------------------------------------------------------------library(rayshader) library(rayvista)library(sf)library(terra)library(gifski)# pre-processing ----------------------------------------------------------r <-rast("data/GEBCO_10_Aug_2024_8ceb2074bd31/gebco_2024_n-40.5121_s-42.294_w173.4459_e175.7843.tif")# Reproject the raster to NZTM2000 (EPSG:2193)r <-project(r, "EPSG:2193")# Convert to a matrix suitable for rayshaderelevation_matrix <-raster_to_matrix(r)# rayshader ---------------------------------------------------------------# Create rayshader plotelevation_matrix |>sphere_shade(texture ="imhof1", sunangle =45) |># creates colour gradientadd_shadow(ray_shade(elevation_matrix), 0.5) |># adds shadowadd_shadow(ambient_shade(elevation_matrix), 0) |># adds ambient light (looks nice but very slow)plot_3d(elevation_matrix,zscale =100,water =TRUE,wateralpha =0.5,watercolor ="#4F42B5",waterlinecolor =NULL,waterdepth =0,windowsize =c(1300, 1000),zoom =0.7 )# animate -----------------------------------------------------------------# Function to create each frame with varying water depthcreate_frame <-function(waterdepth) { elevation_matrix |>sphere_shade(texture ="imhof1", sunangle =45) |># creates colour gradientadd_shadow(ray_shade(elevation_matrix), 0.5) |># adds shadowadd_shadow(ambient_shade(elevation_matrix, multicore =TRUE), 0) |># adds ambient light (looks nice but very slow)plot_3d(elevation_matrix,zscale =100,water =TRUE,wateralpha =0.5,watercolor ="#4F42B5",waterlinecolor =NULL,waterdepth = waterdepth,windowsize =c(1300, 1000),zoom =0.7 )# Save the current framerender_snapshot(paste0("frames/frame_", sprintf("%03d", abs(waterdepth)), ".png"))}# Create frames for depths from 0 to -1000 in steps of -50depths <-seq(0, -270, by =-2)lapply(depths, create_frame)# Combine frames into a GIFgifski(png_files =sprintf("frames/frame_%03d.png", abs(depths)), gif_file ="water_depth_animation.gif", delay =0.08)# Or combine frames into a videoav::av_encode_video(input =sprintf("frames/frame_%03d.png", abs(depths)), output ="water_depth_animation.mp4", framerate =10)# Clean up: remove individual frame files after creating the animation# file.remove(sprintf("frames/frame_%03d.png", abs(depths)))# scenario 1 --------------------------------------------------------------# Create rayshader plotelevation_matrix |>sphere_shade(texture ="imhof1", sunangle =45) |># creates colour gradientadd_shadow(ray_shade(elevation_matrix), 0.5) |># adds shadowadd_shadow(ambient_shade(elevation_matrix, multicore =TRUE), 0) |># adds ambient light (looks nice but very slow)plot_3d(elevation_matrix,zscale =100,water =TRUE,wateralpha =0.5,watercolor ="#4F42B5",waterlinecolor =NULL,waterdepth =-140,windowsize =c(1300, 1000),zoom =0.7,phi =89.9,theta =-0.7 )render_snapshot("scenario_1.png")# scenario 2 --------------------------------------------------------------# Create rayshader plotelevation_matrix |>sphere_shade(texture ="imhof1", sunangle =45) |># creates colour gradientadd_shadow(ray_shade(elevation_matrix), 0.5) |># adds shadowadd_shadow(ambient_shade(elevation_matrix, multicore =TRUE), 0) |># adds ambient light (looks nice but very slow)plot_3d(elevation_matrix,zscale =100,water =TRUE,wateralpha =0.5,watercolor ="#4F42B5",waterlinecolor =NULL,waterdepth =-200,windowsize =c(1300, 1000),zoom =0.7,phi =89.9,theta =-0.7 )render_snapshot("scenario_2.png")
1 Introduction
With the Aratere ferry once again playing bumper boats during docking, and the dream of a bridge or tunnel across the Cook Strait sinking faster than a lead balloon, it’s clear we need a new approach. So, let’s toss conventional wisdom overboard and consider something truly bold: draining the Cook Strait to create a land route between the North and South Islands.
Yes, you read that right.
2 Extending SH1
Scenic Route: Paraparaumu to Nelson
Armed with some bathymetric data and a healthy dose of dystopian satire, I’ve mapped out the potential routes for our new inter-island highway. The first scenario, perfect for those who love a scenic drive, proposes draining a moderate depth of water to establish a route between Paraparaumu and Nelson. It’s a bit longer, sure, but think of the coastal views!
Speedy Shortcut: Wellington to Blenheim
Alternatively, if you’re in a hurry to get from Wellington to Blenheim, we can opt to drain a greater depth of water for a more direct route. Picture it: a swift, straight drive through what was once ocean. Just watch out for the occasional leftover fish.
3 Beyond Cook Strait
Of course, this raises the question: where else should we drain next? Perhaps a road trip to the Chatham Islands is in order? Imagine cruising along the ocean floor, past ancient shipwrecks and submerged ecosystems, all the way to your holiday destination.
In a world of endless possibilities—and an endless supply of satire—draining the Cook Strait might just be the wacky, out-of-the-box solution we’ve been searching for. So, what do you think? Time to roll up our sleeves and start digging?
Disclaimer: no oceans were harmed in the making of this blog post.