3D forest height maps with ggplot2 and rayshader in R

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 96

  • @brunob.7792
    @brunob.7792 Рік тому +7

    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!

    • @milos-makes-maps
      @milos-makes-maps  Рік тому +2

      Wow, that's incredible! I hope you didn't fry your CPU 🤯. I might give it a try with Amazon in the future! Thanks for trying out my new tutorial and happy that it worked for you!

    • @santiago_s
      @santiago_s Рік тому

      @@milos-makes-maps i'm trying with a laptop :( lol!
      How works with Amazon? Could you teach us?

    • @strangerr4980
      @strangerr4980 11 місяців тому

      @@milos-makes-mapsWhat are the your computer operating system and graphics card specifications? and what time did you create this map sir?

  • @vishalmishra3590
    @vishalmishra3590 9 місяців тому +1

    Milos you are amazing! Thanks a lot for teaching all of us this

  • @AleksPopovic
    @AleksPopovic Рік тому +6

    Whoa, this looks great! Love the 3d stuff you put up every time!

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Thanks Aleks! I enjoy creating and sharing the 3d rendering tutorials

  • @manivannansekar5026
    @manivannansekar5026 9 місяців тому +1

    Amazing. make one tutorial for river please

    • @milos-makes-maps
      @milos-makes-maps  9 місяців тому

      Hey, I've already created a tutorial on 3D river basin maps. Check it out on my channel!

  • @daniela_rondon
    @daniela_rondon Рік тому +1

    Wow, just amazing!!! Thank you for sharing

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Hi Daniela, you’re very welcome! I’m so happy to hear that you found the tutorial amazing. You made my day with your comment. 😊

  • @zhengpengfei6047
    @zhengpengfei6047 Рік тому +1

    What a great work!Thank you!

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Thank you for your kind words! I’m glad you enjoyed the tutorial and found it useful. I appreciate your support and encouragement. 😊

  • @akshitgautam4206
    @akshitgautam4206 Рік тому +1

    Really like your work!

  • @johneagle4384
    @johneagle4384 Рік тому +1

    Wow, this is so cool!!!

  • @cahierCanada
    @cahierCanada Рік тому +1

    Amazing! Thank you so much!

  • @mahatmaalimibrahim6631
    @mahatmaalimibrahim6631 Рік тому +1

    Fantastic as usual. Thank you.

  • @jacksonkimani3336
    @jacksonkimani3336 Рік тому +1

    Great work Sir Milos.. I am greatly inspired with this..

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Thank you very much! I’m happy to hear that you are inspired by this. I hope you have fun creating your own 3D maps. 😄

  • @elisaurysuarez5927
    @elisaurysuarez5927 7 місяців тому +1

    ¡Great!

  • @imranhossain934
    @imranhossain934 7 місяців тому +1

    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.

    • @milos-makes-maps
      @milos-makes-maps  7 місяців тому +1

      Hello! Firstly, a huge thank you for the positive feedback on the tutorial-it's fantastic to know it resonated with you! I'm sorry for any trouble caused by the link issue. It appears the files have been relocated.
      Good news, though! You can access the interactive tile map by downloading the HTML file from this link:
      libdrive.ethz.ch/index.php/s/cO8or7iOe5dT2Rt/download?path=%2F&files=tile_index.html
      Once downloaded, simply open the file in a web browser, and you'll be all set!

    • @imranhossain934
      @imranhossain934 6 місяців тому +1

      Hello Sir.. Thank you very very much for your kind help.. I successfully made the forest height map of Sundarbans Mangrove Forest in Bangladesh. It was a wonderful experience for me.. Thank you angain..

  • @nicolasvereecken8791
    @nicolasvereecken8791 3 місяці тому

    Milos thank you so much for this tutorial, it provides great insights and perspectives! I wrote to you on IG a while back too. I was wondering if you could help me debug have installed version 3.3.6 of ggplot2 as you recommended, everything goes smoothly to map forest height of Socotra island until step #7 where I get the following error message:
    Error in check_inherits(layout, "Layout") :
    could not find function "check_inherits"
    I suspect this has to do with something in the ggplot function (and therefore in ggplot2 version 3.3.6.) since there is no other function named "check_inherits"?
    Thanks a lot in advance for your comments in case you come along here to check the comments on this great tutorial (and all the others!)!

  • @pallavshrestha5698
    @pallavshrestha5698 Рік тому +1

    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.

    • @milos-makes-maps
      @milos-makes-maps  Рік тому +2

      Hi Pallav! These days I use VSCode and I have a tutorial that walks you through the process of installing and setting up R in VSCode here: ua-cam.com/video/k79H8EeR5Jo/v-deo.html

  • @coyotefire69420
    @coyotefire69420 Місяць тому +1

    Hey Milos, Its been a year since this video came out and people are still learning from it (namely myself!) However I have run into an error in positron when trying to Open the Copernicus Data. My Positron console is giving me the error of ".zip not recognized" from the URL Download sequence of code. Do you know a work around? Ive tried searching for an answer on github but havent come up with anything yet. Thanks for all the tutorials! You rock

    • @milos-makes-maps
      @milos-makes-maps  Місяць тому

      Thank you! I’m happy you still find this tutorial helpful. But in this one I don’t use data from Copernicus. Are you referring to a different video?

    • @coyotefire69420
      @coyotefire69420 Місяць тому

      @@milos-makes-maps Hahaha yes, I have a few of your videos up right now as reminds and became confused. The video I referred to is the "3D Forest Type Maps in Rayshader and R" focusing on using Copernicus from Slovenia Forest Types. I found a possible work around for setting my directory and pointing my Positron console to my working folder but if you have any tips that would be awesome! I havent worked with R before. Also, I found your youtube through your LinkedIn! Thanks for being the best.

  • @elisaurysuarez5927
    @elisaurysuarez5927 7 місяців тому +1

    My computer literally explodes with that render

  • @sohom-
    @sohom- Рік тому +1

    I am getting this error in the last step of "rendering object". Can you help me with this please.
    Error in if (id) rgl.attrib.count(id, "colors") else rgl.getcolorcount() :
    argument is not interpretable as logical

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Hey, it seems that you are getting an error when using the `plot_gg()` function from the `rayshader` package in R. This error is caused by an incompatibility between the `rayshader` and `scales` packages, which are used to create the hillshade and shadow effects on the plot.
      There are a few possible solutions to this problem:
      - You can try to install the latest development versions of the `rayshader` and `rayrender` packages from GitHub, which may have fixed this issue. To do this, you need to run the following commands in R:
      ```r
      # if package is missing, run `install.packages("remotes")` first
      remotes::install_github("tylermorganwall/rayshader")
      remotes::install_github("tylermorganwall/rayrender")
      ```
      - You can try to adjust the `width` and `height` parameters of the `plot_gg()` function to match the aspect ratio of your plot. For example, if your plot is square, you can use `width = 4000` and `height = 4000`.
      - You can try to remove and reinstall the `rayshader` package from CRAN, and restart your session

  • @avirals_space2917
    @avirals_space2917 10 місяців тому +1

    Sir am getting constant error of "libs' file not found..what can i do?

    • @milos-makes-maps
      @milos-makes-maps  10 місяців тому

      Please make sure that you create the libs object by running the code lines 6-9

  • @Rohit-tx7bm
    @Rohit-tx7bm 11 місяців тому +1

    Which programming language use hare?

  • @joshdaking2324
    @joshdaking2324 10 місяців тому +1

    Where are these packages installed from?

    • @milos-makes-maps
      @milos-makes-maps  10 місяців тому +1

      CRAN if it's a released version, or a GitHub repo if it's a development version

    • @joshdaking2324
      @joshdaking2324 10 місяців тому +1

      Great, thank you sir

  • @mirkodelfinsoruco8686
    @mirkodelfinsoruco8686 Рік тому +1

    from where you get the png map of "portugal-forest-height-2020.png)

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Hey, you can find it on the project's website that I showed in the tutorial before you load the data part

  • @Aztech501
    @Aztech501 9 місяців тому +1

    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

    • @milos-makes-maps
      @milos-makes-maps  9 місяців тому +1

      Hi, this is the problem with the terra package. The owner of terra suggests to install the latest development (GitHub) version of the package. If the problem persists please reach to the owner of terra

  • @christostheocharidis2037
    @christostheocharidis2037 Рік тому +1

    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 ?

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Thanks! Really sorry to hear that you have such serious optimization issues with classInt. What is the style that you use? Can you try quantile or equal? Also, if it doesn't work you could also skip that part

    • @christostheocharidis2037
      @christostheocharidis2037 Рік тому +1

      @@milos-makes-maps It ran eventually with the fisher method but after one hour approximately.

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      @@christostheocharidis2037 wow 😨, that doesn't sound good!

  • @mirkodelfinsoruco8686
    @mirkodelfinsoruco8686 Рік тому +1

    I generated a mosaic based on an image from ggogle earth and saved it as a png, but I get the following error (Error in rayrender::obj_model(cache_filename, x = -bbox_center[1], y = -bbox_center[2], :
    unused argument (texture = TRUE)

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Could you please install the latest newest version of rayshader using devtools::install_github("tylermorganwall/rayshader")

  • @h.rainakkhanreal3090
    @h.rainakkhanreal3090 9 місяців тому

    Hi Milos, amazing tutorial. However, I am getting stuck in Section 5. Breaks classInt: classIntervals. This part of the code in Rstudio keeps on running forever, with no output. I left it running for 8 hours and finally had to interrupt and close R. This happened both for Portugal and Bangladesh. Is there any solution to this? I am using an intel i9 RTX 4080 laptop.
    I would like to add:
    - when trying 'equal' and 'quantile', the output is immediate. It is the style = 'fisher' that's causing this issue. Equal/quantile style maps look pretty bad for Bangladesh, with canopy height of 1m covering majority of the country.

  • @technoplus6895
    @technoplus6895 11 місяців тому +1

    after rendering i got totally pink png,why is that

    • @milos-makes-maps
      @milos-makes-maps  11 місяців тому

      That's not good. Can you check if you downloaded the tiles and loaded them into R?

  • @camilaberger2980
    @camilaberger2980 Рік тому +1

    For me it shows this error when try to create the forest hight rasters
    Error in (function (classes, fdef, mtable) :
    unable to find an inherited method for function ‘mosaic’ for signature ‘"SpatRaster", "missing"’

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Hey, this error suggests that no raster files were passed to terra::mosaic so I wonder if you set the working directory to the same place where you downloaded the raster files. Does that help?

    • @camilaberger2980
      @camilaberger2980 Рік тому +1

      ​@@milos-makes-maps ahh did not clarify, i am sorry, with portugal it worked, but i am doing with another country (Paraguay) with one raster only, and it show the messege i sent. I already check and it is the same with portugal archives, same directory. The "forest_height_rasters" is loaded, but when i run the "forest_height_mosaic" which is the next code it didnt and shows me the that msg. I also loaded this raster in qgis and it worked fine. Do you know a code that i just use an already download raster? besides when i closed and loaded de portugal project it does not load well, it seems i have to erase the download rasters from the directory and start all again.

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      @@camilaberger2980 thanks for clarifying the example! If you are working with a single raster file you don't have to turn it into a mosaic. In fact, you can just load it into terra with terra::rast.

    • @camilaberger2980
      @camilaberger2980 Рік тому +1

      Thank you very much @@milos-makes-maps. Now it shows "Error: memory exhausted (limit reached?)" can I just cut this raster in qgis to exacly the area that i wanted bc i want just a tiny area. I unior in R, thats why the basic cuestions, i apoligize.

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      @@camilaberger2980 ahh that's annoying, I had that error popping up on MacBook frequently. You can definitely cut the area in QGIS and use terra::rast to load it into R

  • @S.P.Sathya
    @S.P.Sathya 8 місяців тому

    m just little confused ,is the commands used directly in r studio or did in vscode

  • @haipokung7926
    @haipokung7926 Рік тому +1

    good figure❤❤❤

  • @shynei6601
    @shynei6601 9 місяців тому +1

    Hi Milos, very nice tutorial. Unfortunately, I have weird things happening.. If you, or someone else can help me please
    I've taken the data from France.
    At the step of plotting the map with ggplot, it only renders a part of the map (I have downloaded all the data I need) and shows me this warning message:
    "
    Warning message:
    Raster pixels are placed at uneven horizontal intervals and will be shifted
    Consider using `geom_tile()` instead.
    "
    I tried to use geom_tile() but it didn't work.
    Also, in the next step (yes, I tried even though the one before was weird), it didn't render anything (I got a white window), and gave me some weird errors/warnings:
    "
    Error: '\U' used wError: '\U' used without hex digiError: '\U' used without hex digits in character string (:4:36)
    Error: '\U' used without hex digits in character string (:4:36)
    Errorror: '\U' using (:4:36)Execution halted
    Executi: '\U' useded without hex digits without hex digits in character string (:4:36)
    in cExecution halted
    on halted
    Execution halt
    Execution halted
    iExecution halted
    ts in characteng (:r string 4:36)
    haract(Eer strinxecution hg (:4:36:4:36)
    d
    Execution halted
    Error in makePSOCKcluster(names = spec, ...) :
    Cluster setup failed. 12 of 12 workers failed to connect.
    In addition: Warning messages:
    1: Raster pixels are placed at uneven horizontal intervals and will be shifted
    Consider using `geom_tile()` instead.
    2: Raster pixels are placed at uneven horizontal intervals and will be shifted
    Consider using `geom_tile()` instead.
    "
    Thanks

    • @milos-makes-maps
      @milos-makes-maps  9 місяців тому

      Hey, it's a pity that you can't replicate my code. You can ignore the warning message. About the long and obscure error: please update rayshader with all it's dependencies

    • @shynei6601
      @shynei6601 9 місяців тому +1

      @@milos-makes-maps ​Thank you for your help, updating rayshader and all it's dependencies didn't help. However, I found that making the multicore parameter to false fixed the error for me.

  • @boi_ratie
    @boi_ratie Рік тому +1

    This is a lovely tutorial. I tried to replicate it on my own but i kept encountering this error (/Forests/ETH_GlobalCanopyHeight_10m_2020_N36W009_Map.tif' not recognized as a supported file format. (GDAL error 4) ) the workig directory if the same as the script and the files and i tried to reload the packages but its stil not working. Your assistance wil be highly appreciated.

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Thank you so much! I'm sad to hear that my code doesn't work for you. Can you tell me if this error occurs on Mac or Windows? Also, what is the part of the code that triggers the error?

    • @Gomey.
      @Gomey. Рік тому +1

      @@milos-makes-maps Hi Milos Awesome tutoring. I am running into the same issue.I am running the code on windows. If you don't mind helping out this is the exact error I get Error: [rast] cannot open this file as a SpatRaster: C:/Users/pathtofolder/ETH_GlobalCanopyHeight_10m_2020_N36W009_Map.tif.

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      @@Gomey. Hey, what is the part of my script that returns this error?

    • @Gomey.
      @Gomey. Рік тому +1

      @@milos-makes-maps Hi Milos,
      its this part I think it has something to do with the terra::rast part.
      I also tried it by setting the full.names = F when defining he raster_files to see if without the folder directory and only the file name it would reader but that had no impact.
      forest_height_list

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      @@Gomey. Hmmm, can you confirm that you have raster files in your working directory? Also, if you are working with a single raster file you shouldn't be using `lapply`. It's sufficient to use terra::rast("raster.tif"), where "raster.tif" is the name of your raster file

  • @RemoteSensingGIS-o4k
    @RemoteSensingGIS-o4k Рік тому

    Hello sir, If I've already download the raster with the download code and want to do rest of the process later. is it possible to run the the rest of the code? or need to download again?

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      Hi, can you, please, run one code chunk at a time so that we can determine where the code breaks first? Also, please make sure that the downloaded files are in your working directory

  • @codeessentialske
    @codeessentialske Рік тому

    Nice work. Which code editor is this?

  • @johanesmachela
    @johanesmachela Рік тому +1

    Greetings, and thank you for your incredible efforts! I am highly interested by this project, and I made an attempt to replicate the work by utilizing your provided code. unfortunately, I encountered an issue when attempting to run it. especially at this function
    forest_height_mosaic

    • @milos-makes-maps
      @milos-makes-maps  Рік тому +1

      Greetings! Thanks for your kind words and for your interest in my tutorial! Your message tells me that a missing object rather than SpatRaster was passed to terra. This would suggest that forest_height_rasters could be empty. If this is true, then you need to check if you are loading the raster files from your designated working directory. Can you, please, check if this is the case?

    • @johanesmachela
      @johanesmachela Рік тому +1

      @@milos-makes-maps Yes its, some place there is empty.

    • @milos-makes-maps
      @milos-makes-maps  Рік тому

      @@johanesmachela Ok, so the next step is to make sure that the place where you downloaded your raster files is the same as your working directory in R. Can you check if they match? getwd() is the command in R to print your current working directory