Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#986 closed task (fixed)

[raster] ST_Sum

Reported by: Bborie Park Owned by: Bborie Park
Priority: medium Milestone: PostGIS 2.0.0
Component: raster Version: master
Keywords: history Cc:

Description

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)
  1. ST_Sum(rast raster, nband int) -> double precision

assumes hasnodata = TRUE

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

assumes nband = 1

ST_Sum(rast, TRUE)
  1. 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)
  1. 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)
  1. 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)
  1. ST_ApproxSum(rast raster, sample_percent double precision) -> double precision

assumes that nband = 1 and hasnodata = TRUE

ST_ApproxSum(rast, 0.25)
  1. 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)
  1. ST_Sum(rastertable text, rastercolumn text, nband int) -> double precision

hasnodata = TRUE

ST_Sum('tmax_2010', 'rast', 1)
  1. ST_Sum(rastertable text, rastercolumn text, hasnodata boolean) -> double precision

nband = 1

ST_Sum('precip_2011', 'rast', TRUE)
  1. 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)
  1. 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)
  1. 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)
  1. 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)
  1. 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')

Change History (3)

comment:1 Changed 10 years ago by Bborie Park

Owner: changed from pracine to Bborie Park
Status: newassigned

Added in r7246.

comment:2 Changed 10 years ago by Bborie Park

Resolution: fixed
Status: assignedclosed

comment:3 Changed 10 years ago by Bborie Park

Keywords: history added
Milestone: PostGIS Raster FuturePostGIS 2.0.0
Note: See TracTickets for help on using tickets.