繁体   English   中英

将附加选项传递给 gdal.Translate

[英]Passing additional options to gdal.Translate

我有一个定义栅格数据集转换的vrt文件,我想将其转换为一组gdal.Warpgdal.Translate命令:

<VRTDataset rasterXSize="100" rasterYSize="100">
    <VRTRasterBand dataType="Int16" band="1">
        <NoDataValue>0</NoDataValue>
        <SimpleSource>
            <SourceFilename relativeToVRT="1">input.tiff</SourceFilename>
            <SourceBand>1</SourceBand>
            <SourceProperties RasterXSize="1000" RasterYSize="1000" DataType="Int16"/>
            <SrcRect xOff="25" yOff="200" xSize="50" ySize="50"/>
            <DstRect xOff="25" yOff="25" xSize="50" ySize="50"/>
        </SimpleSource>
    </VRTRasterBand>
</VRTDataset>

这种转变做了两件事:

  1. 从 input.tiff 中提取 50x50 像素input.tiff
  2. 将这个 50x50 像素 window 放入新图像中,每侧有一个 25 像素的NoData缓冲区。

现在我有这个:

from osgeo import gdal

input_image = gdal.Open('input.tiff')
input_image_window = [25, 200, 50, 50]
gdal.Translate('output.tiff', input_image, srcWin=input_image_window, noData=0)

但是我找不到在gdal.Translategdal.Warp中定义DstRect的等效参数。 我已经为此检查了文档,似乎在 python 绑定 arguments 中没有等效项。有谁知道如何提供DstRect或类似的 arguments 到gdal.Translate

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM