Making pretty river basin maps with R

Поделиться
HTML-код
  • Опубликовано: 10 янв 2025

Комментарии • 35

  • @AleksPopovic
    @AleksPopovic Год назад +1

    Sweet tutorial Milos! Awesome work!

  • @omery.4290
    @omery.4290 Год назад +1

    thanks for sharing

  • @jacksonkimani3336
    @jacksonkimani3336 Год назад +1

    This is awesome and I want to implement on a small area before I try a larger area.

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Thank you for your comment and interest in my tutorial. I’m glad you liked it and want to try it out yourself. 😊
      Do you need my assistance with cropping a smaller area?

    • @jacksonkimani3336
      @jacksonkimani3336 Год назад +1

      @@milos-makes-maps with cropping, I think I can do that in QGIS, or does R have the functionality in-built?

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      @@jacksonkimani3336 you can do it either in R using terra::crop(your_raster, your_shp, snap = "in", mask = T) or QGIS

  • @LauraPeculiar
    @LauraPeculiar Год назад

    Thank you very much!

  • @marinamalavasi8028
    @marinamalavasi8028 Год назад +1

    Incredible video, I managed to complete it entirely. I'm from Brazil, and I loved that you used the country as inspiration.

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Hi Marina, thank you for your kind words. I’m glad you enjoyed the video and completed the exercise. I’m also happy to hear that you are from Brazil, a country with many beautiful and diverse river basins. I hope you learned something new and useful from the video. Keep up the good work! 😊

  • @ehoumanevans4783
    @ehoumanevans4783 Год назад +1

    Thank you very much. I've been looking for such materials.
    Please what editor do you use?

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      You are welcome! I use VS Code and I've prepared a tutorial that will help you set up R in VsCode here: ruclips.net/video/k79H8EeR5Jo/видео.html

  • @ChloeSummers-n8y
    @ChloeSummers-n8y Год назад +1

    Hello! I am getting familiar with R and followed this video and plan to follow more. Is there a way to subset for a specific river basin? I would like to map the Michigan Flint River and tributaries. Thank you for any assistance!

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Hi, welcome aboard and thanks for trying my tutorial 😊! Can you try the following steps in order to subset the Michigan Flint River and its tributaries from HydroSHEDS:
      1) download the HydroSHEDS basin level 12 and the HydroSHEDS river network for North America
      2) load both shapefiles into R using the `sf` package.
      3) Subset the Michigan flint river basin with HYBAS_ID == 7030000000
      3) Clip the river network with the filtered basin using the `st_intersection` function.
      Let me know how it goes!

  • @elisaurysuarez5927
    @elisaurysuarez5927 Год назад +1

    Amazing

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Thank you for your kind words! I'm thrilled to hear that you found the tutorial on creating crisp river basin maps with R and ggplot2 amazing. It's always rewarding to know that the content resonates with readers like you. If you have any questions or need further assistance, feel free to reach out. Happy mapping!

  • @miriam_mov
    @miriam_mov 7 месяцев назад

    Great tutorial Milos! It was really easy to follow and undertand, However, I was trying to apply it to get a map for North Spain (cantabrian basin) and I´m not getting how to focus on such a specific/small area... any ideas?
    Also when I tried to get the plot for Spain as a whole I get the following error: "Error in geom_sf(data = spain_river_basin_width, aes(color = factor("HYBAS_ID"), : non-numeric argument for binary operator". Do you have any tips for that?

  • @Aaqib..
    @Aaqib.. Год назад +1

    thanks a lot sir for this.going to try this now. these are very beneficial for study area mapping of river related research. i think theres a specific package as well called "rivnet" for river network analysis using DEM , maintained by Luca Carraro, ETH zurich.

    • @milos-makes-maps
      @milos-makes-maps  Год назад +1

      You're welcome! I'm glad to hear that the information was helpful for your study area mapping of river-related research. Yes, you're right, there is a specific package called "rivnet" for river network analysis using DEM, maintained by Luca Carraro at ETH Zurich. I'll definitely give it a try. Hope it will be useful for your research, too. Let me know if you have any questions or if there's anything else I can help with. 😊

  • @vladimirmijatovic883
    @vladimirmijatovic883 Год назад +1

    How do I fix or expand intersection, in order to fully show rivers that are passing on country borders? For example, if you would use country 'Serbia', the river Danube, on the eastern border wouldn't be shown in full, but jagged. What I would like to do is to show fully rivers if they are on country borders; and maybe even lakes.

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Hey, Vladimir, great question! I would create a small buffer around the borders using sf::st_buffer and then use this object to clip the rivers

    • @vladimirmijatovic883
      @vladimirmijatovic883 Год назад

      @@milos-makes-maps thanks! I have tried that, and it solves one problem (showing rivers on one border), but it introduces another problem - where country border is exactly on a mountain range (that is also divider between two basins). Try Switzerland -> southern border is mountain range that divides two basins. I would need to find a way to have buffer on one part of the map and not on another. Doable, but not so easy :P

  • @amdjedhydrau6688
    @amdjedhydrau6688 Год назад +1

    hey Mr.Milos thank you for sharing this , please what does mean this error Error in if (nchar(dsn) < 1) stop("`dsn` must point to a source, not an empty string.", :
    the condition has length > 1

    • @milos-makes-maps
      @milos-makes-maps  Год назад

      Hello, it seems that you are trying to read a shapefile in R using the st_read function, but you are getting an error message that says “dsn must point to a source, not an empty string.” This means that the function cannot find the file path that you specified in the dsn argument. Can you check if your working directory in R matches the directory where the shape file is located. You can use getwd() in R to determine your working directory in R

    • @amdjedhydrau6688
      @amdjedhydrau6688 Год назад +1

      @@milos-makes-maps a lot of thanks

  • @ehsanulbari6933
    @ehsanulbari6933 Год назад +1

    Hello, if i want to add a legend on the map what will be the code and where to add this?

    • @milos-makes-maps
      @milos-makes-maps  Год назад +1

      Hi, you can add a legend by modifying my code on line 208 in the GitHub repo. Just replace legend.position = "none" to legend.position = "top". Other positions are possible so check out ggplot2 manual

  • @spandandutta7113
    @spandandutta7113 2 месяца назад

    Hello Sir,
    I am new to R Studio. I am trying to create my first map by following your tutorial
    I am trying to create a basin map of India, I am following every steps
    but when I am trying to clip the river basin it’s showing “error in usemethod(“st_intersection”)
    No applicable method for ‘st_intersection’ applied to an object of class “function”.
    Please help
    And one more question, how to see the map ?

  • @adil5596
    @adil5596 9 месяцев назад

    I took your code from GitHub and copy pasted it in R, and now I am getting this error message, "although coordinates are longitude/latitude, st_intersection assumes that they are planar
    Warning message:
    attribute variables are assumed to be spatially constant throughout all geometries ".
    Please help.

    • @milos-makes-maps
      @milos-makes-maps  9 месяцев назад

      Hello, that's a warning that you turned off spherical geometry not an error

  • @technoplus6895
    @technoplus6895 9 месяцев назад

    how to make this for a country

    • @milos-makes-maps
      @milos-makes-maps  9 месяцев назад

      This tutorial shows you how to make a river basin map of any country