GDALWarp返回NULL而不设置错误

问题描述 投票:1回答:1

GDALWarpDestName返回NULL而不设置错误

我试图重新采样几个栅格(在TIF中)到粗分辨率,而gdalwarp运行结果为null

def resam(inDs):
 gdal.Open(inDs)
 (shotname,extension) = os.path.splitext(os.path.basename(inDs)) # get the filename and extension
 outDs = shotname+'_232_ave'+extension      #result tif of resample
 gdal.Warp(outDs, inDs,
              format = 'GTiff',
              xRes = 232.03572204, yRes = 232.03572204,
              resampleAlg = gdal.GRA_Average)
if __name__ == '__main__':
files = os.listdir(path)

for file in files:
        inDs = file # input tif
        resam(inDs)

预期结果应该重新采样当前路径目录中的所有文件到xRes * yRes分辨率,即232.03572204。

python gdal
1个回答
0
投票

“GDALWarpDestName返回NULL而不设置错误”可能是由输入错误或无效引起的,因此请检查您的inD。

An example with bad URL input.

An example with invalid filename input(点击上一个主题获取更多详情)。

© www.soinside.com 2019 - 2024. All rights reserved.