[postgis-devel] [PostGIS] #986: [raster] ST_Sum

PostGIS trac at osgeo.org
Tue May 24 10:53:57 PDT 2011


#986: [raster] ST_Sum
----------------------------+-----------------------------------------------
 Reporter:  dustymugs       |       Owner:  pracine              
     Type:  task            |      Status:  new                  
 Priority:  medium          |   Milestone:  PostGIS Raster Future
Component:  postgis raster  |     Version:  trunk                
 Keywords:                  |  
----------------------------+-----------------------------------------------
 This function calls ST_SummaryStats and only returns the sum from that
 function.

 1. ST_Sum(rast raster, nband int, hasnodata boolean) -> double precision

     returns the sum as an integer

     nband: index of band

     hasnodata: if FALSE, any pixel who's value is nodata is ignored

 {{{
 ST_Sum(rast, 1, FALSE)
 }}}

 2. ST_Sum(rast raster, nband int) -> double precision

     assumes hasnodata = TRUE

 {{{
 ST_Sum(rast, 2)
 }}}

 3. ST_Sum(rast raster, hasnodata boolean) -> double precision

     assumes nband = 1

 {{{
 ST_Sum(rast, TRUE)
 }}}

 4. ST_Sum(rast raster) -> double precision

     assumes nband = 1 and hasnodata = TRUE

 {{{
 ST_Sum(rast)
 }}}

 The set of ST_ApproxSum functions are:

 1. ST_ApproxSum(rast raster, nband int, hasnodata boolean, sample_percent
 double precision) -> double precision

     sample_percent: a value between 0 and 1 indicating the percentage of
 the raster band's pixels to consider

 {{{
 ST_ApproxSum(rast, 3, FALSE, 0.1)

 ST_ApproxSum(rast, 1, TRUE, 0.5)
 }}}

 2. ST_ApproxSum(rast raster, nband int, sample_percent double precision)
 -> double precision

     assumes that nband = 1

 {{{
 ST_ApproxSum(rast, 2 0.01)

 ST_ApproxSum(rast, 4, 0.025)
 }}}

 3. ST_ApproxSum(rast raster, hasnodata boolean, sample_percent double
 precision) -> double precision

     assumes that nband = 1

 {{{
 ST_ApproxSum(rast, FALSE, 0.01)

 ST_ApproxSum(rast, TRUE, 0.025)
 }}}

 4. ST_ApproxSum(rast raster, sample_percent double precision) -> double
 precision

     assumes that nband = 1 and hasnodata = TRUE

 {{{
 ST_ApproxSum(rast, 0.25)
 }}}

 5. ST_ApproxSum(rast raster) -> double precision

     assumes that nband = 1, hasnodata = TRUE and sample_percent = 0.1

 {{{
 ST_ApproxSum(rast)
 }}}

 The following functions are provided for coverage tables.

 1. ST_Sum(rastertable text, rastercolumn text, nband int, hasnodata
 boolean) -> double precision

     rastertable: name of table with raster column

     rastercolumn: name of column of data type raster

 {{{
 ST_Sum('tmax_2010', 'rast', 1, FALSE)

 ST_Sum('precip_2011', 'rast', 1, TRUE)
 }}}

 2. ST_Sum(rastertable text, rastercolumn text, nband int) -> double
 precision

     hasnodata = TRUE

 {{{
 ST_Sum('tmax_2010', 'rast', 1)
 }}}

 3. ST_Sum(rastertable text, rastercolumn text, hasnodata boolean) ->
 double precision

     nband = 1

 {{{
 ST_Sum('precip_2011', 'rast', TRUE)
 }}}

 4. ST_Sum(rastertable text, rastercolumn text) -> double precision

     nband = 1 and hasnodata = TRUE

 {{{
 ST_Sum('tmin_2009', 'rast')
 }}}

 Variations for ST_ApproxSum are:

 1. ST_ApproxSum(rastertable text, rastercolumn text, nband int, hasnodata
 boolean, sample_percent double precision) -> double precision

 {{{
 ST_ApproxSum('tmax_2010', 'rast', 1, FALSE, 0.5)

 ST_ApproxSum('precip_2011', 'rast', 1, TRUE, 0.2)
 }}}

 2. ST_ApproxSum(rastertable text, rastercolumn text, nband int,
 sample_percent double precision) -> double precision

     hasnodata = TRUE

 {{{
 ST_ApproxSum('tmax_2010', 'rast', 1, 0.5)

 ST_ApproxSum('precip_2011', 'rast', 1, 0.2)
 }}}

 3. ST_ApproxSum(rastertable text, rastercolumn text, hasnodata boolean,
 sample_percent double precision) -> double precision

     nband = 1

 {{{
 ST_ApproxSum('tmax_2010', 'rast', FALSE, 0.5)

 ST_ApproxSum('precip_2011', 'rast', TRUE, 0.2)
 }}}

 4. ST_ApproxSum(rastertable text, rastercolumn text, sample_percent double
 precision) -> double precision

     nband = 1 and hasnodata = TRUE

 {{{
 ST_ApproxSum('tmax_2010', 'rast', 0.5)

 ST_ApproxSum('precip_2011', 'rast', 0.2)
 }}}

 5. ST_ApproxSum(rastertable text, rastercolumn text) -> double precision

     nband = 1, hasnodata = TRUE and sample_percent = 0.1

 {{{
 ST_ApproxSum('tmax_2010', 'rast')

 ST_ApproxSum('precip_2011', 'rast')
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/986>
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