Monday, February 21, 2022

MATLAB+GDAL: Zonal statistics

At first, I wanted to extract the raster values from the corresponding Polygon positions directly through MATLAB's built-in FUNCTION. However, after multiple attempts, although the code ran smoothly, the results were always incorrect. Therefore, I used a more labor-intensive method, which involved using the Polygon to crop first and then counting each cropped raster. The code needs to be referenced in conjunction with the Shapefile attribute table, as follows:(一开始,我希望通过MATLAB本身的FUNCTION直接从各栅格数据上提取到Polygon对应位置的栅格数值,可是尝试多次,代码虽然通畅,但结果总是不正确,所以就使用了一个最费事的方法,就是利用Polygon先裁剪,再统计各裁剪的栅格,代码需要结合Shapefile属性表,注意参照如下:)

No comments:

Post a Comment