[gdal-dev] gdal_retile.py killed when dealing with large .vrt + pixel function

Even Rouault even.rouault at spatialys.com
Wed Sep 4 08:27:18 PDT 2019


I cannot reproduce with a test_sum.vrt relying on a tiny 20x20 raster:

<VRTDataset rasterXSize="1178083" rasterYSize="2179667">
  <VRTRasterBand dataType="Byte" band="1" subClass="VRTDerivedRasterBand">
    <PixelFunctionType>max</PixelFunctionType>
    <PixelFunctionLanguage>Python</PixelFunctionLanguage>
    <PixelFunctionCode><![CDATA[
import numpy as np
def max(in_ar, out_ar, xoff, yoff, xsize, ysize, raster_xsize, raster_ysize, buf_radius, gt, **kwargs):
    np.round_(np.clip(np.max(in_ar, axis = 0),0,255), out = out_ar)
]]>
    </PixelFunctionCode>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">byte.tif</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="20" RasterYSize="20" DataType="Byte" BlockXSize="20" BlockYSize="20" />
      <SrcRect xOff="0" yOff="0" xSize="20" ySize="20" />
      <DstRect xOff="0" yOff="0" xSize="1178083" ySize="2179667" />
    </SimpleSource>
  </VRTRasterBand>
</VRTDataset>


$ GDAL_VRT_ENABLE_PYTHON=YES python swig/python/scripts/gdal_retile.py -v -r bilinear -levels 5 -ps 2048 2048 -co "TILED=YES" -co "COMPRESS=JPEG"  -targetDir pyramid test_sum.vrt
Building internal Index for 1 tile(s) ... finished
Filename: test_sum.vrt
File Size: 1178083x2179667x1
Pixel Size: 1.000000 x -1.000000
UL:(0.000000,0.000000)   LR:(1178083.000000,-2179667.000000)
tileWidth:   2048
tileHeight:  2048
countTilesX: 576
countTilesY: 1065
overlap:     0
pyramid/test_sum_0001_0001.tif : 0|0-->2048-2048
pyramid/test_sum_0001_0002.tif : 2048|0-->2048-2048
pyramid/test_sum_0001_0003.tif : 4096|0-->2048-2048
pyramid/test_sum_0001_0004.tif : 6144|0-->2048-2048
pyramid/test_sum_0001_0005.tif : 8192|0-->2048-2048
pyramid/test_sum_0001_0006.tif : 10240|0-->2048-2048
pyramid/test_sum_0001_0007.tif : 12288|0-->2048-2048
pyramid/test_sum_0001_0008.tif : 14336|0-->2048-2048
pyramid/test_sum_0001_0009.tif : 16384|0-->2048-2048
pyramid/test_sum_0001_0010.tif : 18432|0-->2048-2048
[...]

You'll have to run under a debugger and see where this blows up.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list