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

  Рет қаралды 4,569

Tips for GIS

Tips for GIS

Күн бұрын

Пікірлер: 25
@manala6844
@manala6844 4 жыл бұрын
Valuable and updated knowledge! highly recommend this video
@TipsforGISChannel
@TipsforGISChannel 4 жыл бұрын
Thank you
@mikevillarreal8291
@mikevillarreal8291 3 жыл бұрын
thanks for sharing mate!
@TipsforGISChannel
@TipsforGISChannel 3 жыл бұрын
No problem 👍
@seyedamirhoseinaqili4335
@seyedamirhoseinaqili4335 4 жыл бұрын
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: kzbin.info/www/bejne/oIHHZ6F5m6hmprs 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.
@creekbed
@creekbed 4 жыл бұрын
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
@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 жыл бұрын
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
@ramonkeller9297
@ramonkeller9297 4 жыл бұрын
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.
@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 жыл бұрын
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?
@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?
Automating Raster Data Extraction using Python
21:36
GeoDelta Labs
Рет қаралды 14 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 23 МЛН
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 37 МЛН
plotting maps with geopandas and matplotlib
15:09
101touchapps
Рет қаралды 58 М.
Convert between CSV and GeoTIFF with GDAL in Python
28:11
Making Sense Remotely
Рет қаралды 20 М.
Processing DEMs with GDAL in Python
12:04
Making Sense Remotely
Рет қаралды 14 М.
Calculating Zonal Statistics of a Raster using Python
31:59
GeoDelta Labs
Рет қаралды 14 М.
Extracting Topographic Elevations using Python
16:49
GeoDelta Labs
Рет қаралды 11 М.