[postgis-devel] [PostGIS] #985: [raster] ST_Count

PostGIS trac at osgeo.org
Tue May 24 10:51:48 PDT 2011


#985: [raster] ST_Count
----------------------------+-----------------------------------------------
 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 count from that
 function.

 1. ST_Count(rast raster, nband int, hasnodata boolean) -> integer

     returns the count as an integer

     nband: index of band

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

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

 2. ST_Count(rast raster, nband int) -> integer

     assumes hasnodata = TRUE

 {{{
 ST_Count(rast, 2)
 }}}

 3. ST_Count(rast raster, hasnodata boolean) -> integer

     assumes nband = 1

 {{{
 ST_Count(rast, TRUE)
 }}}

 4. ST_Count(rast raster) -> integer

     assumes nband = 1 and hasnodata = TRUE

 {{{
 ST_Count(rast)
 }}}

 The set of ST_ApproxCount functions are:

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

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

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

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

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

     assumes that nband = 1

 {{{
 ST_ApproxCount(rast, 2 0.01)

 ST_ApproxCount(rast, 4, 0.025)
 }}}

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

     assumes that nband = 1

 {{{
 ST_ApproxCount(rast, FALSE, 0.01)

 ST_ApproxCount(rast, TRUE, 0.025)
 }}}

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

     assumes that nband = 1 and hasnodata = TRUE

 {{{
 ST_ApproxCount(rast, 0.25)
 }}}

 5. ST_ApproxCount(rast raster) -> integer

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

 {{{
 ST_ApproxCount(rast)
 }}}

 The following functions are provided for coverage tables.

 1. ST_Count(rastertable text, rastercolumn text, nband int, hasnodata
 boolean) -> integer

     rastertable: name of table with raster column

     rastercolumn: name of column of data type raster

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

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

 2. ST_Count(rastertable text, rastercolumn text, nband int) -> integer

     hasnodata = TRUE

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

 3. ST_Count(rastertable text, rastercolumn text, hasnodata boolean) ->
 integer

     nband = 1

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

 4. ST_Count(rastertable text, rastercolumn text) -> integer

     nband = 1 and hasnodata = TRUE

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

 Variations for ST_ApproxCount are:

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

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

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

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

     hasnodata = TRUE

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

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

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

     nband = 1

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

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

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

     nband = 1 and hasnodata = TRUE

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

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

 5. ST_ApproxCount(rastertable text, rastercolumn text) -> integer

     nband = 1, hasnodata = TRUE and sample_percent = 0.1

 {{{
 ST_ApproxCount('tmax_2010', 'rast')

 ST_ApproxCount('precip_2011', 'rast')
 }}}

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