Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#953 closed task (fixed)

[raster] ST_ValueCount

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

Description

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)
  1. 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)
  1. 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)
  1. ST_Count(rast raster, value double precision, roundto double precision) -> integer

nband is assumed to be 1. hasnodata is assumed to be TRUE.

  1. 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.

Change History (4)

comment:1 Changed 10 years ago by Bborie Park

Status: newassigned
Summary: [raster] ST_Count[raster] ST_ValueCount

Renamed from ST_Count to ST_ValueCount

comment:2 Changed 10 years ago by Bborie Park

Added to trunk in r7252.

comment:3 Changed 10 years ago by Bborie Park

Resolution: fixed
Status: assignedclosed

comment:4 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.