[postgis-devel] [PostGIS] #1005: [raster] Problem with ST_SummaryStats(text, text) results
PostGIS
trac at osgeo.org
Tue Jun 7 15:07:03 PDT 2011
#1005: [raster] Problem with ST_SummaryStats(text, text) results
----------------------------+-----------------------------------------------
Reporter: pracine | Owner: pracine
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.0.0
Component: postgis raster | Version: trunk
Keywords: |
----------------------------+-----------------------------------------------
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.
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1005>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-devel
mailing list