[gdal-dev] VRT ComputeStatistics fails because of self-reference
Even Rouault
even.rouault at mines-paris.org
Wed May 14 02:22:56 PDT 2014
Matt,
thanks for the report. I'm a bit surprised this hasn't been reported before as
it dates back to 1.10.0. Anyway, I've created a ticket
http://trac.osgeo.org/gdal/ticket/5468 for that issue and pushed a fix for
1.10, 1.11 and trunk branches.
I cannot think to a workaround, apart from upgrading from sources.
Even
> Hi all,
>
> I'm trying to compute statistics on a VRT file using the python
> band.ComputeStatistics method. I'm using GDAL 1.10.1 on a Windows 7
> 64-bit box.
>
> First, I create a VRT clip of a larger raster using gdal_translate, e.g.
>
> gdal_translate -of VRT -projwin <sub_window> in.tif out.vrt
>
> Then, in Python, I try to compute statistics:
>
> ds = gdal.OpenShared('out.vrt', gdalconst.GA_ReadOnly)
> rb = ds.GetRasterBand(1)
> (min, max, mean, std) = rb.ComputeStatistics(False)
>
> This fails with many messages of:
>
> ERROR 1: VRTSourcedRasterBand::IRasterIO() called recursively on
> the same band.
> It looks like the VRT is referencing itself.
> ERROR 1: test.vrt, band 29: IReadBlock failed at X offset 1, Y
> offset 3
>
> I can replicate the same behavior by first creating the VRT using
> gdal_translate and then calling gdalinfo -stats on it.
>
> I see in the code that I'm triggering the bAntiRecursionFlag within the
> GetMinimum and GetMaximum member functions, but unclear how this is
> coming about.
>
> thanks for help,
> matt
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Geospatial professional services
http://even.rouault.free.fr/services.html
More information about the gdal-dev
mailing list