Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#990 closed task (fixed)

[raster] ST_ValuePercent

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

Description

ST_ValueProportion is the sibling of ST_ValueCount and returns the percentage of a raster's band that is of a specified value. To handle floating point values, a rounding argument is provided.

  1. ST_ValueProportion(rast raster, nband integer, hasnodata boolean, search_value double precision, roundto double precision) -> double precision

returns the percentage of the overall raster's bands pixel values that a specific pixel value occurs

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_ValueProportion(rast, 1, TRUE, 23, 0)

ST_ValueProportion(rast, 5, FALSE, 3.14, 0.01)

ST_ValueProportion(rast, 2, TRUE, 100, 100)

ST_ValueProportion(rast, 1, FALSE, -9999, 1)
  1. ST_ValueProportion(rast raster, nband integer, search_value double precision, roundto double precision) -> double precision

hasnodata is assumed to be TRUE

ST_ValueProportion(rast, 5, 3.14, 0.01)

ST_ValueProportion(rast, 2, 100, 100)
  1. ST_ValueProportion(rast raster, nband integer, search_value double precision) -> double precision

roundto is assumed to be 0, so no rounding takes place. hasnodata is assumed to be TRUE

ST_ValueProportion(rast, 1, -9999)
  1. ST_ValueProportion(rast raster, search_value double precision, roundto double precision) -> double precision

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

  1. ST_ValueProportion(rast raster, search_value double precision) -> double precision

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.

To count/get proportion of all unique values in a raster's band, the search_value or search_values paramenter can be set to NULL.

Change History (6)

comment:1 Changed 10 years ago by Bborie Park

Owner: changed from pracine to Bborie Park
Status: newassigned

comment:2 Changed 10 years ago by Bborie Park

Summary: [raster] ST_ValueProportion[raster] ST_ValuePercent

comment:3 Changed 10 years ago by Bborie Park

Added in r7256

comment:4 Changed 10 years ago by Bborie Park

Resolution: fixed
Status: assignedclosed

comment:5 Changed 10 years ago by robe

Keywords: history added
Milestone: PostGIS Raster FuturePostGIS 2.0.0

Bborie,

Need to switch these to PostGIS 2.0.0 if you have them completed. PostGIS Future should only have uncompleted things . The history part doesn't matter too much for these since for Raster there is way too much stuff to itemize in a release anyway. Will probably just do

Lots and Lots of raster analytic functions :)

comment:6 Changed 10 years ago by Bborie Park

Thanks for reminding me about that. I've corrected all the other tickets... I think.

-bborie

Note: See TracTickets for help on using tickets.