Minimal

Day 16 of 30DayMapChallenge
R
30DayMapChallenge
datavisualization
raster
spatial
Author

Michaël

Published

2022-11-16

Modified

2024-04-12

Photo of Piton de la Fournaise and Formica Leo

Piton de La Fournaise – CC BY-NC-ND by Jean-Paul Tonnelier

Day 16 of 30DayMapChallenge: « minimal » (previously).

Bare Réunion…

library(rayshader)
library(raster)
library(tidyverse)
library(fs)
library(httr)
library(glue)

data_dir <- path_expand("~/data/bdalti/974")

# https://geoservices.ign.fr/bdalti
if (!dir_exists(data_dir)) {
  dir_create(data_dir)
  
  GET("https://wxs.ign.fr/aqd29otkz2hofiee5pb0fygn/telechargement/prepackage/BDALTI-25M_PACK_REU_14-12-2020$BDALTIV2_2-0_25M_ASC_RGR92UTM40S-REUN89_D974_2016-03-11/file/BDALTIV2_2-0_25M_ASC_RGR92UTM40S-REUN89_D974_2016-03-11.7z",
      write_disk(glue("{data_dir}/dl.7z")))
  
  system(glue("7z e -y -o{data_dir} {data_dir}/dl.7z"))
}

# We get a bunch of ASCII files : open and merge, convert to matrix used by rayshader
elmat <- dir_ls(data_dir, glob = "*.asc") %>% 
  map(raster) %>% 
  reduce(merge) %>% 
  raster_to_matrix()

elmat %>%
  sphere_shade(texture = "desert") %>%
  add_shadow(ray_shade(elmat, zscale = 3), 0.5) %>%
  add_shadow(ambient_shade(elmat), 0) %>%
  plot_3d(elmat, zscale = 10, fov = 0, theta = 135, zoom = 0.75, phi = 45, windowsize = c(1000, 800))

render_snapshot("reunion_3d.jpeg")

A 3D view of Réunion Island

Bare Réunion