3D forest height maps with ggplot2 and rayshader in R

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ต.ค. 2024

ความคิดเห็น • 93

  • @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 8 หลายเดือนก่อน

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

  • @vishalmishra3590
    @vishalmishra3590 7 หลายเดือนก่อน +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

  • @cahierCanada
    @cahierCanada 9 หลายเดือนก่อน +1

    Amazing! Thank you so much!

  • @mahatmaalimibrahim6631
    @mahatmaalimibrahim6631 ปีที่แล้ว +1

    Fantastic as usual. Thank you.

  • @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. 😊

  • @johneagle4384
    @johneagle4384 ปีที่แล้ว +1

    Wow, this is so cool!!!

  • @akshitgautam4206
    @akshitgautam4206 ปีที่แล้ว +1

    Really like your work!

  • @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. 😊

  • @elisaurysuarez5927
    @elisaurysuarez5927 4 หลายเดือนก่อน +1

    ¡Great!

  • @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 4 หลายเดือนก่อน +1

    My computer literally explodes with that render

  • @manivannansekar5026
    @manivannansekar5026 7 หลายเดือนก่อน +1

    Amazing. make one tutorial for river please

    • @milos-makes-maps
      @milos-makes-maps  7 หลายเดือนก่อน

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

  • @nicolasvereecken8791
    @nicolasvereecken8791 หลายเดือนก่อน

    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!)!

  • @imranhossain934
    @imranhossain934 4 หลายเดือนก่อน +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  4 หลายเดือนก่อน +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 4 หลายเดือนก่อน +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..

  • @haipokung7926
    @haipokung7926 9 หลายเดือนก่อน +1

    good figure❤❤❤

  • @pallavshrestha5698
    @pallavshrestha5698 9 หลายเดือนก่อน +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  9 หลายเดือนก่อน +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: th-cam.com/video/k79H8EeR5Jo/w-d-xo.html

  • @h.rainakkhanreal3090
    @h.rainakkhanreal3090 7 หลายเดือนก่อน

    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.

  • @sohom-
    @sohom- 10 หลายเดือนก่อน +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  10 หลายเดือนก่อน

      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

  • @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

  • @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")

  • @avirals_space2917
    @avirals_space2917 8 หลายเดือนก่อน +1

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

    • @milos-makes-maps
      @milos-makes-maps  8 หลายเดือนก่อน

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

  • @shynei6601
    @shynei6601 7 หลายเดือนก่อน +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  7 หลายเดือนก่อน

      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 7 หลายเดือนก่อน +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.

  • @Aztech501
    @Aztech501 7 หลายเดือนก่อน +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  7 หลายเดือนก่อน +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

  • @Rohit-tx7bm
    @Rohit-tx7bm 9 หลายเดือนก่อน +1

    Which programming language use hare?

  • @joshdaking2324
    @joshdaking2324 8 หลายเดือนก่อน +1

    Where are these packages installed from?

    • @milos-makes-maps
      @milos-makes-maps  8 หลายเดือนก่อน +1

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

    • @joshdaking2324
      @joshdaking2324 8 หลายเดือนก่อน +1

      Great, thank you sir

  • @S.P.Sathya
    @S.P.Sathya 6 หลายเดือนก่อน

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

  • @boi_ratie
    @boi_ratie 11 หลายเดือนก่อน +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  11 หลายเดือนก่อน

      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. 11 หลายเดือนก่อน +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  11 หลายเดือนก่อน

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

    • @Gomey.
      @Gomey. 11 หลายเดือนก่อน +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  11 หลายเดือนก่อน

      @@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

  • @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

  • @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!

  • @technoplus6895
    @technoplus6895 9 หลายเดือนก่อน +1

    after rendering i got totally pink png,why is that

    • @milos-makes-maps
      @milos-makes-maps  9 หลายเดือนก่อน

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

  • @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

  • @RemoteSensingGIS-o4k
    @RemoteSensingGIS-o4k 10 หลายเดือนก่อน

    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  10 หลายเดือนก่อน

      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?

    • @milos-makes-maps
      @milos-makes-maps  ปีที่แล้ว

      Thanks! This is VSCode

    • @strangerr4980
      @strangerr4980 9 หลายเดือนก่อน

      @@milos-makes-maps also we have created this in r- stusio?

  • @MrMaubitch
    @MrMaubitch 8 หลายเดือนก่อน +1

    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!

    • @milos-makes-maps
      @milos-makes-maps  8 หลายเดือนก่อน +2

      Thank you! They messed up something with the page 😔. But I found the solution. You should download this html file and open it via your browser: libdrive.ethz.ch/index.php/s/cO8or7iOe5dT2Rt/download?path=%2F&files=tile_index.html