</refsection>
</refentry>
- <refentry id="histogram">
- <refnamediv>
- <refname>histogram</refname>
- <refpurpose>A composite type used as record output of the ST_Histogram and ST_ApproxHistogram functions.</refpurpose>
- </refnamediv>
- <refsection>
- <title>Description</title>
- <para>A composite type used as record outputs of the <xref linkend="RT_ST_Histogram" /> <varname>ST_ApproxHistogram</varname> functions. Note that depending on <varname>exclude_nodata_value</varname> of function, may or may not contain nodata pixels.</para>
- <para>Each histogram record in results corresponds to a bin for a selected raster band.</para>
- <variablelist>
- <varlistentry>
- <term><parameter>min </parameter><type>double precision</type></term>
- <listitem><para>minimum pixel value in this bin</para></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>max </parameter><type>double precision</type></term>
- <listitem><para>Maximum pixel value in this bin.</para></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>count </parameter><type>integer</type></term>
- <listitem><para>count of pixels in this bin.</para></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>percent </parameter><type>double precision</type></term>
- <listitem><para>Percent of pixels of the overall population in this bin.</para></listitem>
- </varlistentry>
- </variablelist>
- </refsection>
- <refsection>
- <title>See Also</title>
- <para><xref linkend="RT_ST_Histogram" /></para>
- </refsection>
- </refentry>
-
<refentry id="raster">
<refnamediv>
<refname>raster</refname>
<refentry id="RT_ST_Histogram">
<refnamediv>
<refname>ST_Histogram</refname>
- <refpurpose>Returns a set of histogram summarizing a raster or raster coverage data distribution separate bin ranges. Number of bins are autocomputed if not specified.</refpurpose>
+ <refpurpose>Returns a set of record summarizing a raster or raster coverage data distribution separate bin ranges. Number of bins are autocomputed if not specified.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>SETOF histogram <function>ST_Histogram</function></funcdef>
+ <funcdef>SETOF record <function>ST_Histogram</function></funcdef>
<paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
<paramdef choice="opt"><type>integer </type> <parameter>nband=1</parameter></paramdef>
<paramdef choice="opt"><type>boolean </type> <parameter>exclude_nodata_value=true</parameter></paramdef>
</funcprototype>
<funcprototype>
- <funcdef>SETOF histogram <function>ST_Histogram</function></funcdef>
+ <funcdef>SETOF record <function>ST_Histogram</function></funcdef>
<paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
<paramdef><type>integer </type> <parameter>nband</parameter></paramdef>
<paramdef><type>integer </type> <parameter>bins</parameter></paramdef>
</funcprototype>
<funcprototype>
- <funcdef>SETOF histogram <function>ST_Histogram</function></funcdef>
+ <funcdef>SETOF record <function>ST_Histogram</function></funcdef>
<paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
<paramdef><type>integer </type> <parameter>nband</parameter></paramdef>
<paramdef><type>boolean </type> <parameter>exclude_nodata_value</parameter></paramdef>
</funcprototype>
<funcprototype>
- <funcdef>SETOF histogram <function>ST_Histogram</function></funcdef>
+ <funcdef>SETOF record <function>ST_Histogram</function></funcdef>
<paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
<paramdef><type>integer </type> <parameter>nband</parameter></paramdef>
<paramdef><type>integer </type> <parameter>bins</parameter></paramdef>
</funcprototype>
<funcprototype>
- <funcdef>SETOF histogram <function>ST_Histogram</function></funcdef>
+ <funcdef>SETOF record <function>ST_Histogram</function></funcdef>
<paramdef><type>text </type> <parameter>rastertable</parameter></paramdef>
<paramdef><type>text </type> <parameter>rastercolumn</parameter></paramdef>
<paramdef><type>integer </type> <parameter>nband</parameter></paramdef>
</funcprototype>
<funcprototype>
- <funcdef>SETOF histogram <function>ST_Histogram</function></funcdef>
+ <funcdef>SETOF record <function>ST_Histogram</function></funcdef>
<paramdef><type>text </type> <parameter>rastertable</parameter></paramdef>
<paramdef><type>text </type> <parameter>rastercolumn</parameter></paramdef>
<paramdef><type>integer </type> <parameter>nband</parameter></paramdef>
</funcprototype>
<funcprototype>
- <funcdef>SETOF histogram <function>ST_Histogram</function></funcdef>
+ <funcdef>SETOF record <function>ST_Histogram</function></funcdef>
<paramdef><type>text </type> <parameter>rastertable</parameter></paramdef>
<paramdef><type>text </type> <parameter>rastercolumn</parameter></paramdef>
<paramdef choice='opt'><type>integer </type> <parameter>nband=1</parameter></paramdef>
</funcprototype>
<funcprototype>
- <funcdef>SETOF histogram <function>ST_Histogram</function></funcdef>
+ <funcdef>SETOF record <function>ST_Histogram</function></funcdef>
<paramdef><type>text </type> <parameter>rastertable</parameter></paramdef>
<paramdef><type>text </type> <parameter>rastercolumn</parameter></paramdef>
<paramdef choice='opt'><type>integer </type> <parameter>nband=1</parameter></paramdef>
<refsection>
<title>Description</title>
- <para>Returns set of <varname>histogram</varname> records consisting of min,max, count, percent for a given raster band for each bin. If no band is specified <varname>nband</varname> defaults to 1. </para>
+ <para>Returns set of records consisting of min, max, count, percent for a given raster band for each bin. If no band is specified <varname>nband</varname> defaults to 1. </para>
<note><para>By default only considers pixel values not equal to the <varname>nodata</varname> value . Set <varname>exclude_nodata_value</varname> to false to get count all pixels.</para></note>
<variablelist>
<refsection>
<title>See Also</title>
- <para><xref linkend="histogram" />, <xref linkend="RT_ST_Count" />, <xref linkend="RT_ST_SummaryStats" /></para>
+ <para>
+ <xref linkend="RT_ST_Count" />,
+ <xref linkend="RT_ST_SummaryStats" />
+ </para>
</refsection>
</refentry>
-----------------------------------------------------------------------
-- ST_Histogram and ST_ApproxHistogram
-----------------------------------------------------------------------
-CREATE TYPE histogram AS (
- min double precision,
- max double precision,
- count bigint,
- percent double precision
-);
-
-- Cannot be strict as "width", "min" and "max" can be NULL
CREATE OR REPLACE FUNCTION _st_histogram(
rast raster, nband int DEFAULT 1,
sample_percent double precision DEFAULT 1,
bins int DEFAULT 0, width double precision[] DEFAULT NULL,
right boolean DEFAULT FALSE,
- min double precision DEFAULT NULL, max double precision DEFAULT NULL
+ min double precision DEFAULT NULL, max double precision DEFAULT NULL,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
)
- RETURNS SETOF histogram
+ RETURNS SETOF record
AS 'MODULE_PATHNAME','RASTER_histogram'
LANGUAGE 'c' IMMUTABLE;
-- Cannot be strict as "width" can be NULL
-CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, bins int DEFAULT 0, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_histogram(
+ rast raster, nband int DEFAULT 1,
+ exclude_nodata_value boolean DEFAULT TRUE,
+ bins int DEFAULT 0, width double precision[] DEFAULT NULL,
+ right boolean DEFAULT FALSE,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, 1, $4, $5, $6) $$
LANGUAGE 'sql' IMMUTABLE;
-CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, exclude_nodata_value boolean, bins int, right boolean)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_histogram(
+ rast raster, nband int,
+ exclude_nodata_value boolean,
+ bins int,
+ right boolean,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, 1, $4, NULL, $5) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-- Cannot be strict as "width" can be NULL
-CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, bins int, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_histogram(
+ rast raster, nband int,
+ bins int, width double precision[] DEFAULT NULL,
+ right boolean DEFAULT FALSE,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, 1, $3, $4, $5) $$
LANGUAGE 'sql' IMMUTABLE;
-CREATE OR REPLACE FUNCTION st_histogram(rast raster, nband int, bins int, right boolean)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_histogram(
+ rast raster, nband int,
+ bins int,
+ right boolean,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, 1, $3, NULL, $4) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
exclude_nodata_value boolean DEFAULT TRUE,
sample_percent double precision DEFAULT 0.1,
bins int DEFAULT 0, width double precision[] DEFAULT NULL,
- right boolean DEFAULT FALSE
+ right boolean DEFAULT FALSE,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
)
- RETURNS SETOF histogram
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, $4, $5, $6, $7) $$
LANGUAGE 'sql' IMMUTABLE;
-CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, exclude_nodata_value boolean, sample_percent double precision, bins int, right boolean)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rast raster, nband int,
+ exclude_nodata_value boolean,
+ sample_percent double precision,
+ bins int,
+ right boolean,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, $3, $4, $5, NULL, $6) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, sample_percent double precision)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rast raster, nband int,
+ sample_percent double precision,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, $3, 0, NULL, FALSE) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, sample_percent double precision)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rast raster,
+ sample_percent double precision,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, 1, TRUE, $2, 0, NULL, FALSE) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-- Cannot be strict as "width" can be NULL
-CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, sample_percent double precision, bins int, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rast raster, nband int,
+ sample_percent double precision,
+ bins int, width double precision[] DEFAULT NULL,
+ right boolean DEFAULT FALSE,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, $3, $4, $5, $6) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION st_approxhistogram(rast raster, nband int, sample_percent double precision, bins int, right boolean)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rast raster, nband int,
+ sample_percent double precision,
+ bins int, right boolean,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT min, max, count, percent FROM _st_histogram($1, $2, TRUE, $3, $4, NULL, $5) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
exclude_nodata_value boolean DEFAULT TRUE,
sample_percent double precision DEFAULT 1,
bins int DEFAULT 0, width double precision[] DEFAULT NULL,
- right boolean DEFAULT FALSE
+ right boolean DEFAULT FALSE,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
)
- RETURNS SETOF histogram
+ RETURNS SETOF record
AS 'MODULE_PATHNAME','RASTER_histogramCoverage'
LANGUAGE 'c' IMMUTABLE;
-CREATE OR REPLACE FUNCTION st_histogram(rastertable text, rastercolumn text, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, bins int DEFAULT 0, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_histogram(
+ rastertable text, rastercolumn text, nband int DEFAULT 1,
+ exclude_nodata_value boolean DEFAULT TRUE,
+ bins int DEFAULT 0, width double precision[] DEFAULT NULL,
+ right boolean DEFAULT FALSE,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, $3, $4, 1, $5, $6, $7) $$
LANGUAGE 'sql' STABLE;
-CREATE OR REPLACE FUNCTION st_histogram(rastertable text, rastercolumn text, nband int, exclude_nodata_value boolean, bins int, right boolean)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_histogram(
+ rastertable text, rastercolumn text, nband int,
+ exclude_nodata_value boolean,
+ bins int,
+ right boolean,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, $3, $4, 1, $5, NULL, $6) $$
LANGUAGE 'sql' STABLE STRICT;
-- Cannot be strict as "width" can be NULL
-CREATE OR REPLACE FUNCTION st_histogram(rastertable text, rastercolumn text, nband int, bins int, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_histogram(
+ rastertable text, rastercolumn text, nband int,
+ bins int, width double precision[] DEFAULT NULL,
+ right boolean DEFAULT FALSE,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, $3, TRUE, 1, $4, $5, $6) $$
LANGUAGE 'sql' STABLE;
-CREATE OR REPLACE FUNCTION st_histogram(rastertable text, rastercolumn text, nband int, bins int, right boolean)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_histogram(
+ rastertable text, rastercolumn text, nband int,
+ bins int,
+ right boolean,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, $3, TRUE, 1, $4, NULL, $5) $$
LANGUAGE 'sql' STABLE STRICT;
exclude_nodata_value boolean DEFAULT TRUE,
sample_percent double precision DEFAULT 0.1,
bins int DEFAULT 0, width double precision[] DEFAULT NULL,
- right boolean DEFAULT FALSE
+ right boolean DEFAULT FALSE,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
)
- RETURNS SETOF histogram
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, $3, $4, $5, $6, $7, $8) $$
LANGUAGE 'sql' STABLE;
-CREATE OR REPLACE FUNCTION st_approxhistogram(rastertable text, rastercolumn text, nband int, exclude_nodata_value boolean, sample_percent double precision, bins int, right boolean)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rastertable text, rastercolumn text, nband int,
+ exclude_nodata_value boolean,
+ sample_percent double precision,
+ bins int,
+ right boolean,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, $3, $4, $5, $6, NULL, $7) $$
LANGUAGE 'sql' STABLE STRICT;
-CREATE OR REPLACE FUNCTION st_approxhistogram(rastertable text, rastercolumn text, nband int, sample_percent double precision)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rastertable text, rastercolumn text, nband int,
+ sample_percent double precision,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, $3, TRUE, $4, 0, NULL, FALSE) $$
LANGUAGE 'sql' STABLE STRICT;
-CREATE OR REPLACE FUNCTION st_approxhistogram(rastertable text, rastercolumn text, sample_percent double precision)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rastertable text, rastercolumn text,
+ sample_percent double precision,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, 1, TRUE, $3, 0, NULL, FALSE) $$
LANGUAGE 'sql' STABLE STRICT;
-- Cannot be strict as "width" can be NULL
-CREATE OR REPLACE FUNCTION st_approxhistogram(rastertable text, rastercolumn text, nband int, sample_percent double precision, bins int, width double precision[] DEFAULT NULL, right boolean DEFAULT FALSE)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rastertable text, rastercolumn text, nband int,
+ sample_percent double precision,
+ bins int, width double precision[] DEFAULT NULL,
+ right boolean DEFAULT FALSE,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, $3, TRUE, $4, $5, $6, $7) $$
LANGUAGE 'sql' STABLE STRICT;
-CREATE OR REPLACE FUNCTION st_approxhistogram(rastertable text, rastercolumn text, nband int, sample_percent double precision, bins int, right boolean)
- RETURNS SETOF histogram
+CREATE OR REPLACE FUNCTION st_approxhistogram(
+ rastertable text, rastercolumn text, nband int,
+ sample_percent double precision,
+ bins int,
+ right boolean,
+ OUT min double precision,
+ OUT max double precision,
+ OUT count bigint,
+ OUT percent double precision
+)
+ RETURNS SETOF record
AS $$ SELECT _st_histogram($1, $2, $3, TRUE, $4, $5, NULL, $6) $$
LANGUAGE 'sql' STABLE STRICT;
OUT count integer,
OUT percent double precision
)
+ RETURNS SETOF record
AS 'MODULE_PATHNAME', 'RASTER_valueCount'
LANGUAGE 'c' IMMUTABLE;
OUT count integer,
OUT percent double precision
)
+ RETURNS SETOF record
AS 'MODULE_PATHNAME', 'RASTER_valueCountCoverage'
LANGUAGE 'c' STABLE;