From: Bborie Park Date: Sun, 29 Jul 2012 02:34:08 +0000 (+0000) Subject: Removed summarystats data type. Ticket is #1939 X-Git-Tag: 2.1.0beta2~735 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e41250ad4ef0faeffb211142646d45d385d77607;p=postgis Removed summarystats data type. Ticket is #1939 git-svn-id: http://svn.osgeo.org/postgis/trunk@10133 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index d66ae5db5..d388c8433 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -268,47 +268,8 @@ VALUES (1, - - - summarystats - A composite type used as output of the ST_SummaryStats function. - - - Description - A composite type used as output the ST_SummaryStats function. Note that depending on exclude_nodata_value of function, may or may not contain nodata pixels. - - - count bigint - count of pixels in raster band. Depending on arguments may or many not include nodata pixel values. - - - sum double precision - sum of all pixel values in band - - - mean double precision - Mean of pixel values - - - stddev double precision - Standard deviation of pixel values. - - - min double precision - Minimum pixel value - - - max double precision - Maximum pixel value - - - - - See Also - - - + Raster Management @@ -5531,26 +5492,26 @@ ORDER BY value, quantile,rid ST_SummaryStats - Returns summary stats consisting of count,sum,mean,stddev,min,max for a given raster band of a raster or raster coverage. Band 1 is assumed is no band is specified. + Returns record consisting of count, sum, mean, stddev, min, max for a given raster band of a raster or raster coverage. Band 1 is assumed is no band is specified. - summarystats ST_SummaryStats + record ST_SummaryStats text rastertable text rastercolumn boolean exclude_nodata_value - summarystats ST_SummaryStats + record ST_SummaryStats raster rast boolean exclude_nodata_value - summarystats ST_SummaryStats + record ST_SummaryStats text rastertable text rastercolumn integer nband=1 @@ -5558,7 +5519,7 @@ ORDER BY value, quantile,rid - summarystats ST_SummaryStats + record ST_SummaryStats raster rast integer nband boolean exclude_nodata_value @@ -5571,7 +5532,7 @@ ORDER BY value, quantile,rid Description - Returns summarystats consisting of count, sum, mean, stddev, min, max for a given raster band of a raster or raster coverage. If no band is specified nband defaults to 1. + Returns record consisting of count, sum, mean, stddev, min, max for a given raster band of a raster or raster coverage. If no band is specified nband defaults to 1. By default only considers pixel values not equal to the nodata value. Set exclude_nodata_value to false to get count of all pixels. @@ -5662,7 +5623,7 @@ FROM (SELECT band, ST_SummaryStats('o_4_boston','rast', band,true,0.25) As stats See Also , -, + diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index d85b4c733..36449bd63 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -311,82 +311,205 @@ CREATE OR REPLACE FUNCTION st_band(rast raster, nbands text, delimiter char DEFA ----------------------------------------------------------------------- -- ST_SummaryStats and ST_ApproxSummaryStats ----------------------------------------------------------------------- -CREATE TYPE summarystats AS ( - count bigint, - sum double precision, - mean double precision, - stddev double precision, - min double precision, - max double precision -); - -CREATE OR REPLACE FUNCTION _st_summarystats(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1) - RETURNS summarystats +CREATE OR REPLACE FUNCTION _st_summarystats( + rast raster, + nband int DEFAULT 1, + exclude_nodata_value boolean DEFAULT TRUE, + sample_percent double precision DEFAULT 1, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS 'MODULE_PATHNAME','RASTER_summaryStats' LANGUAGE 'c' IMMUTABLE; -CREATE OR REPLACE FUNCTION st_summarystats(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_summarystats( + rast raster, + nband int DEFAULT 1, + exclude_nodata_value boolean DEFAULT TRUE, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, $2, $3, 1) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_summarystats(rast raster, exclude_nodata_value boolean) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_summarystats( + rast raster, + exclude_nodata_value boolean, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, 1, $2, 1) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_approxsummarystats( + rast raster, + nband int DEFAULT 1, + exclude_nodata_value boolean DEFAULT TRUE, + sample_percent double precision DEFAULT 0.1, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, $2, $3, $4) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, nband int, sample_percent double precision) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_approxsummarystats( + rast raster, + nband int, + sample_percent double precision, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, $2, TRUE, $3) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, exclude_nodata_value boolean, sample_percent double precision DEFAULT 0.1) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_approxsummarystats( + rast raster, + exclude_nodata_value boolean, + sample_percent double precision DEFAULT 0.1, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, 1, $2, $3) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rast raster, sample_percent double precision) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_approxsummarystats( + rast raster, + sample_percent double precision, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, 1, TRUE, $2) $$ LANGUAGE 'sql' IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION _st_summarystats(rastertable text, rastercolumn text, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1) - RETURNS summarystats +CREATE OR REPLACE FUNCTION _st_summarystats( + rastertable text, + rastercolumn text, + nband integer DEFAULT 1, + exclude_nodata_value boolean DEFAULT TRUE, + sample_percent double precision DEFAULT 1, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS 'MODULE_PATHNAME','RASTER_summaryStatsCoverage' LANGUAGE 'c' IMMUTABLE; -CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_summarystats( + rastertable text, + rastercolumn text, + nband integer DEFAULT 1, + exclude_nodata_value boolean DEFAULT TRUE, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, $2, $3, $4, 1) $$ LANGUAGE 'sql' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_summarystats(rastertable text, rastercolumn text, exclude_nodata_value boolean) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_summarystats( + rastertable text, + rastercolumn text, + exclude_nodata_value boolean, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, $2, 1, $3, 1) $$ LANGUAGE 'sql' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, nband integer DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 0.1) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_approxsummarystats( + rastertable text, + rastercolumn text, + nband integer DEFAULT 1, + exclude_nodata_value boolean DEFAULT TRUE, + sample_percent double precision DEFAULT 0.1, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, $2, $3, $4, $5) $$ LANGUAGE 'sql' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, nband integer, sample_percent double precision) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_approxsummarystats( + rastertable text, + rastercolumn text, + nband integer, + sample_percent double precision, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, $2, $3, TRUE, $4) $$ LANGUAGE 'sql' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, exclude_nodata_value boolean) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_approxsummarystats( + rastertable text, + rastercolumn text, + exclude_nodata_value boolean, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, $2, 1, $3, 0.1) $$ LANGUAGE 'sql' STABLE STRICT; -CREATE OR REPLACE FUNCTION st_approxsummarystats(rastertable text, rastercolumn text, sample_percent double precision) - RETURNS summarystats +CREATE OR REPLACE FUNCTION st_approxsummarystats( + rastertable text, + rastercolumn text, + sample_percent double precision, + OUT count bigint, + OUT sum double precision, + OUT mean double precision, + OUT stddev double precision, + OUT min double precision, + OUT max double precision +) AS $$ SELECT _st_summarystats($1, $2, 1, TRUE, $3) $$ LANGUAGE 'sql' STABLE STRICT; @@ -448,7 +571,6 @@ CREATE OR REPLACE FUNCTION _st_count(rastertable text, rastercolumn text, nband ctable text; ccolumn text; rast raster; - stats summarystats; rtn bigint; tmp bigint; diff --git a/raster/rt_pg/rtpostgis_drop.sql.in.c b/raster/rt_pg/rtpostgis_drop.sql.in.c index 0258eefeb..25ee00108 100644 --- a/raster/rt_pg/rtpostgis_drop.sql.in.c +++ b/raster/rt_pg/rtpostgis_drop.sql.in.c @@ -212,6 +212,7 @@ DROP FUNCTION IF EXISTS ST_PixelAsPolygons(raster,integer); -- no longer needed functions changed to use out parameters DROP TYPE IF EXISTS bandmetadata; DROP TYPE IF EXISTS geomvalxy; +DROP TYPE IF EXISTS summarystats; -- raster_columns and raster_overviews tables are deprecated DROP FUNCTION IF EXISTS _rename_raster_tables();