首页 > 解决方案 > 获取 DEM 栅格文件的垂直 (z) 分辨率(使用 gdal 和 python)?

问题描述

我想找到 DEM(数字高程模型)栅格的垂直 (z) 分辨率。

使用 gdal,我可以轻松找到 x 和 y 分辨率和像素宽度:

dem = gdal.Open('DEMraster50.tif')    #DEM is a rectangular tif 
ncol = dem.RasterXSize                #number of columns (aka number of cells along x axis)
nrow = dem.RasterYSize                #number of rows (aka number of cells along y axis)
ulx, pixelwidthx, xskew, uly, yskew, pixelheighty = dem.GetGeoTransform() 
#get resolution and coordinate info (for some reason the order of skew and pixel size is flipped for y axis?!)

我还可以找到最小和最大 z 值(以米为单位的高度):

srcband = dem.GetRasterBand(1)        #get the first band (with the elevation data)
zmin,zmax,zmean,zstdv = srcband.GetStatistics(True, True)  #get stats for this band (automatically ignores nan values)   

但我想要的是在 z 方向上相当于 nrows 和像素宽度。那可能吗?如果有怎么办?谢谢!

编辑:对不起,我有一个糟糕的相机,但这可能会有所帮助。我正在寻找 nlay 和 z 厚度。 光栅网格

标签: pythonresolutionrastergdal

解决方案


推荐阅读