3D forest height maps with ggplot2 and rayshader in R

Published 2023-07-23
In this tutorial, I will show you how to use ggplot2 and rayshader in R to make powerful 3D maps of forest canopy height using the ETH Global Canopy Height dataset. You will learn how to download and process the data, and how to render a crisp 3D map of forest height in Portugal. Whether you are a beginner or an expert in R, this tutorial will help you unleash your creativity and explore the beauty and diversity of forests around the world.🌲🌳🌴

0:00 Prologue
0:58 Intro
01:37 Load libraries
05:07 Twitter post on ETH data
05:43 Grab tile links
09:22 Download tiles
12:36 Portugal regions polygon
16:34 Plot Portugal regions
16:50 Filter regions and union polygons
20:14 Plot Portugal polygon
20:26 Load tiles as list
22:15 Crop tiles
24:17 Merge tiles into mosaic
25:10 Aggregate forest height raster
27:06 Raster to dataframe
28:07 Rename value column
28:46 Legend breaks
31:32 Color palette
33:14 2D map with ggplot2
43:19 Render scene
48:44 Show scene
49:12 Change the scene
50:18 Show re-adjusted scene
50:35 Render object with rayshader
58:17 3D forest height map of Portugal
59:11 Closing

Check the full code in my GitHub repo:
github.com/milos-agathon/3d-forest-height-maps

Follow my work on Instagram:
www.instagram.com/milos_makes_maps

Let's connect on Twitter:
twitter.com/milos_agathon

If you like my work, consider buying me a coffee:
www.buymeacoffee.com/milospopovic

Video credits:
---------------------------------
No Copyright Videos & Musics    / @nocopyrightvideosandmusics  

Music credits:
---------------------------------
Song: Sappheiros - Embrace (Vlog No Copyright Music)
Music promoted by Vlog No Copyright Music.
Video Link:    • Sappheiros - Embrace (Vlog No Copyrig...  

All Comments (21)
  • @vishalmishra3590
    Milos you are amazing! Thanks a lot for teaching all of us this
  • @AleksPopovic
    Whoa, this looks great! Love the 3d stuff you put up every time!
  • @brunob.7792
    i was able to reproduce this! After almost 1hour rendering on a Ryzen 5600x 326g DDR4 ram 3600mhz, i was able to achieve the portugal map.png image on the directory. Also, i was able to watch the whole rendering process. It was amazing! Do amazon rainforest buddy! We brazilians, want to know how the situation is over here with illegal harvesting happening all the time!
  • Hi Milos. I like the editor you are using in this video. Is it Sublime Text? The arguments visualising is pretty helpful, which I don’t find in Rstudio.
  • @imranhossain934
    First of all thenk you for the wonderful tutorial. But I didn't find any map with tiles from where I can download geotiffs. The linh "cloud optimized geotiffs here" is taking me in the another page. So, it would be very nice if you can help me regarding this matter.
  • @MrMaubitch
    Very nice video! Unfortunately, the link to download the cloud optimized geotiffs seems to be offline/not working. Waiting for it to work and try out your awesome tutorial!
  • @Aztech501
    Hi, Milos. I am geting stuck in section 3 (cropping tiles). This part of the code stops showing the next error: Error: [crop] file exists. You can use 'overwrite=TRUE' to overwrite it. If I add this statement to crop function, it works correctly but it doesn't crop properly. Is there any solution to this? The .tiff files are already in the same working folder
  • Great turotial thank you very much. I have also an issue, when I run the classInt: classIntervals, It takes ages to run and never run it. I chose a different study area and I put n = 5 so the dimensions are 1149, 2893 (smaller than the video) but it still do nothing. Is it normal? should I leave it to run ?