[postgis-devel] [PostGIS] #953: [raster] ST_Count
PostGIS
trac at osgeo.org
Mon May 16 16:52:06 PDT 2011
#953: [raster] ST_Count
----------------------------+-----------------------------------------------
Reporter: dustymugs | Owner: dustymugs
Type: task | Status: new
Priority: medium | Milestone: PostGIS Raster Future
Component: postgis raster | Version: trunk
Keywords: |
----------------------------+-----------------------------------------------
ST_Count provides the ability to count the number of times that a user-
provided value is present in a raster. To handle floating point values, a
rounding argument is provided.
1. ST_Count(rast raster, nband integer, hasnodata boolean, value double
precision, roundto double precision) -> integer
returns the number of times that value is present in the raster
hasnodata: if FALSE, nodata values in band are considered in the count.
if TRUE, nodata values are not considered
value: the value to count in the raster
roundto: the decimal position to round a pixel value to. Originally
intended for use with 32BF and 64BF pixel types, it can also be used with
integers when round to the tens, hundreds or higher place.
examples are...
{{{
roundto < 0: no rounding
0: no rounding
0.1: round to the tenths place
0.01: round to the hundredths place
0.001: round to the thousandths place
1: round to the ones place
10: round to the tens place
100: round to the hundreds place
}}}
{{{
ST_Count(rast, 1, TRUE, 23, 0)
ST_Count(rast, 5, FALSE, 3.14, 0.01)
ST_Count(rast, 2, TRUE, 100, 100)
ST_Count(rast, 1, FALSE, -9999, 1)
}}}
2. ST_Count(rast raster, nband integer, value double precision, roundto
double precision) -> integer
hasnodata is assumed to be TRUE
{{{
ST_Count(rast, 5, 3.14, 0.01)
ST_Count(rast, 2, 100, 100)
}}}
3. ST_Count(rast raster, nband integer, value double precision) -> integer
roundto is assumed to be 0, so no rounding takes place. hasnodata is
assumed to be TRUE
{{{
ST_Count(rast, 1, -9999)
}}}
4. ST_Count(rast raster, value double precision, roundto double precision)
-> integer
nband is assumed to be 1. hasnodata is assumed to be TRUE.
5. ST_Count(rast raster, value double precision) -> integer
nband is assumed to be 1. roundto is assumed to be 0, so no rounding
takes place. hasnodata is assumed to be TRUE.
A set of variations where more than one value parameter can be provided
should be added.
A set of variations where no value parameter is provided should be added.
This results in every unique value is counted, unless a roundto parameter
is provided.
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/953>
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