Hi,

I have to retile about 100,000 images of size about 2667x2667 pixels for geoserver. The source images' nodata area were badly damaged due to compression so I decided to use VRT pixel function max to make the result tiles seamless.

However, the output was quite weird -- Killed appeared and the script exited:

Building internal Index for 1 tile(s) ... finished
Filename: test_sum.vrt
File Size: 1178083x2179667x1
Pixel Size: 0.780877 x -0.780877
UL:(10841319.553138,2329047.665115)   LR:(11761257.511933,626995.763142)
tileWidth:   2048
tileHeight:  2048
countTilesX: 576
countTilesY: 1065
overlap:     0
Killed

This is the command that I used:

mkdir pyramid
gdal_retile.py -v -r bilinear -levels 5 -ps 2048 2048 -co "TILED=YES" -co "COMPRESS=JPEG" -targetDir pyramid test_sum.vrt

And the pixel function that I used:

<VRTDataset rasterXSize="1178083" rasterYSize="2179667">
  <SRS>...</SRS>
  <GeoTransform>...</GeoTransform>
  <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>
    <ColorInterp>Gray</ColorInterp>
    <SimpleSource>...</SimpleSource>
    ...
  </VRTRasterBand>
</VRTDataset>

This is what I tried:

- retile the VRT file without pixel function --> OK, but the result isn't seamless (black background of each images are visible)
- retile smaller VRT file (just 5 images) with pixel function --> OK, but incomplete

How can I retile the whole dataset seamlessly?

Software used:

GDAL 2.4.1, released 2019/03/15
Python 2.7.15rc1

Thank you,
Wee.

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to