[gdal-dev] Error in Derived Band in Virtual raster (re-post)

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Mon Dec 2 00:14:36 PST 2019


Hi,

Re-posting because the code section that Nabble wrote as html formatted was dropped out. Did the same thing happen for you with your original mail?

It seems that you have defined a Python function "add2" that does nothing because it has no code

        <PixelFunctionType>add2</PixelFunctionType>
        <PixelFunctionLanguage>Python</PixelFunctionLanguage>
        <PixelFunctionCode>
        </PixelFunctionCode>

You have perhaps tried to modify the example from https://gdal.org/drivers/raster/vrt.html
<PixelFunctionType>add</PixelFunctionType>
        <PixelFunctionLanguage>Python</PixelFunctionLanguage>
        <PixelFunctionCode>

<![CDATA[
            import numpy as np
            def add(in_ar, out_ar, xoff, yoff, xsize, ysize, raster_xsize,
                            raster_ysize, buf_radius, gt, **kwargs):
                np.round_(np.clip(np.sum(in_ar, axis = 0, dtype = 'uint16'),0,255),
                        out = out_ar)
            ]]>
        </PixelFunctionCode>

Have you saved your add2 function into a separate Python script? In that case follow the hillshading.py example.

-Jukka Rahkonen-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20191202/e4fa18b2/attachment.html>


More information about the gdal-dev mailing list