[gdal-dev] python code inside of VRT results to empty values
Even Rouault
even.rouault at spatialys.com
Mon May 25 02:11:08 PDT 2020
Jachym,
> I have some python code inside of VRT file, but I can not produce
> reasonable output with gdal_transalte. All the input data do look ok,
> even when I print() the values I would like to store, the data are
> displayed, but the resulting TIFF file is just empty, any hint how to
> approach?
Can you show the full VRT ?
Can you also try with the below one.vrt
<VRTDataset rasterXSize="5" rasterYSize="5">
<VRTRasterBand dataType="Byte" band="1" subClass="VRTDerivedRasterBand">
<ColorInterp>Gray</ColorInterp>
<PixelFunctionType>ones</PixelFunctionType>
<PixelFunctionLanguage>Python</PixelFunctionLanguage>
<PixelFunctionCode><![CDATA[
def ones(in_ar, out_ar, xoff, yoff, xsize, ysize, raster_xsize, raster_ysize, r, gt, **kwargs):
out_ar.fill(1)
]]>
</PixelFunctionCode>
</VRTRasterBand>
</VRTDataset>
and report the output of
gdal_translate one.vrt /vsistdout/ -of aaigrid --debug ON --config GDAL_VRT_ENABLE_PYTHON YES
on it ?
> I've tested it on gdal 2.2 as well as 3.8
Python 3.8 with GDAL 2.2 might be too recent. There was a fix recently for 3.8.0 on Windows (but you won't
have got to the point where any python code was executed if you hit that bug)
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200525/e0ddbb90/attachment.html>
More information about the gdal-dev
mailing list