If you haven’t already seen, I’ve invited catchment groups to get in touch with me if they’re interested in getting a topographic model of their catchment, and one exciting possibility is printing adjoining catchments at a common scale to fit together like a jigsaw puzzle. This is exactly what the Hawke’s Bay Regional Council (HBRC) requested—a model of all 11 major catchments that fit together to form the entire region.
2 Puzzle pieces
HBRC provided a shapefile of the 11 catchment groupings, conveniently prepared with coincident borders.
Show the code
library(leaflet)library(sf)# Load the catchments datacatchments <-readRDS("hbrc_catchments.RDS")# Make sure the data is projected correctly for Leafletcatchments <-st_transform(catchments, crs =4326) # Convert to WGS84# Create a color palette for the categorical EMA fieldema_palette <-colorFactor(palette ="Set3", domain = catchments$EMA)# Create a leaflet mapleaflet(catchments) |>addProviderTiles("Esri.WorldImagery") |>addPolygons(fillColor =~ema_palette(EMA),weight =2,opacity =1,color ='white',dashArray ='3',fillOpacity =0.9,highlightOptions =highlightOptions(weight =5,color ="#666",dashArray ="",fillOpacity =0.5,bringToFront =TRUE ),label =~EMA,popup =~EMA )