【发布时间】:2020-03-13 20:34:58
【问题描述】:
我有大约 250 个 .ecw 文件,我想使用 GDAL 和 Python 将其转换为 .tif 或 .png 或 .jpg。这是我的代码:
from osgeo import gdal
inputfile = gdal.Open('C:/Users/Berteld/aGIS/python/data/wms/orthophotos_2019/dop20rgb_400_5826_2_be_2019.ecw')
outputfile = 'C:/Users/Berteld/aGIS/python/data/wms/orthophotos_2019/dop20rgb_400_5826_2_be_2019.jpg'
gdal.Translate(inputfile, outputfile)
这会导致
ERROR 4: `C:/Users/Berteld/aGIS/python/data/wms/orthophotos_2019/dop20rgb_400_5826_2_be_2019.ecw' not recognized as a supported file format.
当使用 OSGeo4W Shell 时,它就像一个魅力,但我不想手动为所有文件执行此操作。这些是我的环境变量:
GDAL_DATA = C:\OSGeo4W64\share\gdal
GDAL_DRIVER_PATH = C:\OSGeo4W\bin\gdalplugins
我的错误是什么?
【问题讨论】:
-
好奇,你找到解决办法了吗?
-
很遗憾没有!
标签: python gdal translate osgeo