milos-agathon / 3d-forest-height-maps

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
25 stars 9 forks source link

Vector memory exhausted #2

Open MauKruisheer opened 9 months ago

MauKruisheer commented 9 months ago

Thank you for this great tutorial! I would really like to reproduce this code for the country Kenya, but I have run into this error (which refers to line 161, the ggplot2 section). I tried lower the n class from 5 to 3, to safe memory (?), but this did not work. Any idea how to overcome this issue? Much appreciated!

Error in `geom_raster()` at Projects/ForestHeight/ForestHeight_Kenya.r:161:0:
! Problem while converting geom to grob.
ℹ Error occurred in the 1st layer.
Caused by error:
! vector memory exhausted (limit reached?)
Run `rlang::last_trace()` to see where the error occurred.
Warning messages:
1: In classInt::classIntervals(forest_height_kenya_df$height, n = 3,  :
  N is large, and some styles will run very slowly; sampling imposed
2: Raster pixels are placed at uneven horizontal intervals and will be shifted
ℹ Consider using `geom_tile()` instead. 
3: Raster pixels are placed at uneven horizontal intervals and will be shifted
ℹ Consider using `geom_tile()` instead. 
MauKruisheer commented 8 months ago

Hey, I am still wondering if anyone has any ideas on how to overcome this. Very welcome, and much appreciated. Thanks, Maurits