id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1005	[raster] Problem with ST_SummaryStats(text, text) results	pracine	dustymugs	"I can observe some problems with the numbers returned by the coverage variant of ST_SummaryStats

1) The sum is the sum of the last tile only. Not of the whole coverage.

2) For a raster coverage of two rasters created like this:

{{{

--First test raster
CREATE OR REPLACE FUNCTION ST_TestRaster1() 
    RETURNS raster AS 
    $$
    DECLARE
        newrast raster := ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 1, 1, 0, 0, -1), '32BUI'::text, 0, -1);
    BEGIN
        newrast := ST_SetValue(newrast, 1, 1, 1);
        newrast := ST_SetValue(newrast, 1, 2, 3);
        newrast := ST_SetValue(newrast, 2, 1, 3);
        newrast := ST_SetValue(newrast, 2, 2, 1);
        RETURN newrast;
    END;
    $$
    LANGUAGE 'plpgsql';

--Second test raster
CREATE OR REPLACE FUNCTION ST_TestRaster2() 
    RETURNS raster AS 
    $$
    DECLARE
        newrast raster := ST_AddBand(ST_MakeEmptyRaster(2, 2, 2, 2, 1, 1, 0, 0, -1), '32BUI'::text, 0, -1);
    BEGIN
        newrast := ST_SetValue(newrast, 1, 1, 1);
        newrast := ST_SetValue(newrast, 1, 2, 2);
        newrast := ST_SetValue(newrast, 2, 1, 3);
        newrast := ST_SetValue(newrast, 2, 2, 4);
        RETURN newrast;
    END;
    $$
    LANGUAGE 'plpgsql';

--Create table
DROP TABLE sumstattest;
CREATE TABLE sumstattest AS
 SELECT ST_TestRaster2() rast
 UNION ALL
 SELECT ST_TestRaster1() rast;

}}}

{{{

SELECT * FROM st_summarystats('sumstattest', 'rast');

}}}

should return 1.089724736 not 1.06066017770915.

Result verified with the stdev.p function in Excel.

"	defect	closed	medium	PostGIS 2.0.0	raster	trunk	fixed		
