DEM raster data analysis in Python using rasterio , richDEM , geopandas , and shapely

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

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

  • @manala6844
    @manala6844 4 ปีที่แล้ว

    Valuable and updated knowledge! highly recommend this video

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

    thanks for sharing mate!

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

    Hi,Thanks for your precious content, I have trouble installing richDEM library with both conda install and pip install , do you have any idea what if installing have some issues?

    • @TipsforGISChannel
      @TipsforGISChannel  4 ปีที่แล้ว

      I did not have issues installing richDEM. What kind of error are you getting?
      One other thought, If you have anaconda, can you try the GUI installation

    • @TipsforGISChannel
      @TipsforGISChannel  4 ปีที่แล้ว

      Which version of Python are you using?

    • @seyedamirhoseinaqili4335
      @seyedamirhoseinaqili4335 4 ปีที่แล้ว

      @@TipsforGISChannel python3.7

    • @TipsforGISChannel
      @TipsforGISChannel  4 ปีที่แล้ว

      @@seyedamirhoseinaqili4335 OK how about if you use a virtual environment. It might be that your root Python has a package conflicting with RichDEM. In this video:
      th-cam.com/video/jPd6nCfC3pY/w-d-xo.html
      I explained briefly how to set up a virtual env. It is not complicated. Just make sure you have all the packages you need listed on the requirements.txt file.
      Also, I am planning to create a video soon on how to set up a virtual env for another raster analysis.

  • @abdulhamidmerii5538
    @abdulhamidmerii5538 4 ปีที่แล้ว

    Great Video! I'm just having a hard time understanding what raster.bound() method returns. What do they mean by left, bottom, right, top?

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

      Thank you Abdul. So the bound() method returns the coordinates of the two corners of the raster: left,top and right,bottom. When a raster file is read, it starts from the upper left corner and ends at the lower right corner.
      The concept is similar to reading a table. When you read a table, you start from first row and first column which in other words the upper left cell. The last value you can read is the last row and last column which can be thought of as the lower right cell.
      If you open the DEM file in ArcMap or QGIS for instance, enter the coordinates as longitude -> left and latitude -> top and then longitude -> right and latitude -> bottom, this should help you understand the bounds values returned from the bound() method.

    • @abdulhamidmerii5538
      @abdulhamidmerii5538 4 ปีที่แล้ว

      @@TipsforGISChannel Thank you so much for your comprehensive reply, I really appreciate it! It is much clearer now :D

  • @anesouadou6157
    @anesouadou6157 3 ปีที่แล้ว

    Hello, thank you for the great video. I am using rasterio library to read satellite images. I also use geopandas to read geojson file that contains building coordinates in the form of polygons. I am faicng the following issue. I use index method from rasterio to convert polygon coordinates from the latitude and longitude to matrix coordiante system. Then, I use Pillow library to plot the polygon on an image matrix. The resulting polygon needs to be rotated (np.rot90(original,k=1,axes(0,1))) to be in the correct orientation. Any thoughts on this problem. Many thanks

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

      Hi Anes,
      Sorry I am not familiar with pillow. When you rotate the polygon, do you convert it back to geographic coords?

    • @anesouadou6157
      @anesouadou6157 3 ปีที่แล้ว

      @@TipsforGISChannel I have checked and found that the problem happens when I use index method to convert the coordinates from geographic coordinates to matrix coordinates. Are there any options I can specify in the index method from rasterio?

  • @creekbed
    @creekbed 3 ปีที่แล้ว

    how do you save your slope file (madeenah_rich_slope) as a new .tif file? I would like to be able to export my slope as a .tif so i can proceed with reclassification, but rd.SaveGDAL("file_name_here.tif", madeenah_rich_slope) doesn't seem to work. It throws the error: not a sequence

    • @TipsforGISChannel
      @TipsforGISChannel  3 ปีที่แล้ว

      Hi creekbed,
      Sorry for the late reply. I was not focused on saving the raster in this video as you noticed. But thank you for bringing this important point to my attention. There are two ways to solve your problem with the SaveGDAL method:
      1. When I created the madeenah_richdem using the rd.rdarray class, I should have configured the attributes of projection and geotransform:
      richdem.readthedocs.io/en/latest/examples_python.html?highlight=rdarray#the-rdarray-class
      2. Another solution is to use richdem to load the original tif file instead of reading it from rasterio and assign projection and geotransform using these functions:
      github.com/r-barnes/richdem/issues/20
      I used the functions in the github issue on the second option as:
      madeenah_richdem = rd.LoadGDAL('./madeenah.tif')
      no_data, projection, geotransform, resolution = getMetadata(madeenah_richdem)
      madeenah_rich_slope = rd.TerrainAttribute(madeenah_richdem, attrib='slope_degrees')
      slope_image = np2rdarray(madeenah_rich_slope, no_data, projection, geotransform)
      rd.SaveGDAL('./madinah_slope.tif', slope_image)
      I hope this helps and again thank you for bringing this to my attention :)
      I learned something new

  • @ramonkeller9297
    @ramonkeller9297 3 ปีที่แล้ว

    hi,
    thank you for the great video. Is it possible to use an existing point-shapefile with actual coordinates - geometry=POINT Z (2647908.3141 130972.079 0.000), for example, or with the x and y information 647908/130972 - instead of creating a dictionary? I've got both, rd.array and dem raster all in the same format and coordinate system

    • @TipsforGISChannel
      @TipsforGISChannel  3 ปีที่แล้ว

      Hi Ramon,
      Sorry for the late reply. Yes you can use your own points. In the loop you are referring to for creating a dictionary, I was randomizing points from the grid but you can use your own points. My goal was to show how you can use a dictionary to create a geopandas dataframe since this is an educational video.
      But you can use for example pypi.org/project/pyshp/ to read your shapefile and assign attributes by passing x(s) and y(s) to the rasterio object and get back the i(s) and j(s), and then using i(s) and j(s) to get slope and aspect values. I would use the adding-records to assign attributes --> github.com/GeospatialPython/pyshp#adding-records
      I hope this is clear.

  • @asmitaguha7900
    @asmitaguha7900 4 ปีที่แล้ว

    Hi, it's really a very helpful content. But I wanted to ask that I'm getting error that "PackagesNotFoundError: The following packages are not available from current channels: - richdem". I searched for the error message and I found that specific this package has some issues. Can you help me out with this problem?

    • @TipsforGISChannel
      @TipsforGISChannel  4 ปีที่แล้ว

      So I am assuming that you installed all the packages. You can refer to pypi.org/ to search for the packages needed and how to install them: richdem, rasterio, geopandas, and shapely.

    • @TipsforGISChannel
      @TipsforGISChannel  4 ปีที่แล้ว

      One other note, are you installing packages in a virtual environment?