Schema
public
Owner
albenard
Descriptions
args: rast - Returns a text summary of the contents of the raster.
Options
Option | Value |
---|---|
Returns |
text |
Language |
plpgsql |
Parameters |
rast public.raster |
Definition
CREATE OR REPLACE FUNCTION public.st_summary (
rast public.raster
)
RETURNS text AS
$span$
DECLARE
extent box2d;
metadata record;
bandmetadata record;
msg text;
msgset text[];
BEGIN
extent := public.ST_Extent(rast::geometry);
metadata := public.ST_Metadata(rast);
msg := 'Raster of ' || metadata.width || 'x' || metadata.height || ' pixels has ' || metadata.numbands || ' ';
IF metadata.numbands = 1 THEN
msg := msg || 'band ';
ELSE
msg := msg || 'bands ';
END IF;
msg := msg || 'and extent of ' || extent;
IF
round(metadata.skewx::numeric, 10) <> round(0::numeric, 10) OR
round(metadata.skewy::numeric, 10) <> round(0::numeric, 10)
THEN
msg := 'Skewed ' || overlay(msg placing 'r' from 1 for 1);
END IF;
msgset := Array[]::text[] || msg;
FOR bandmetadata IN SELECT * FROM public.ST_BandMetadata(rast, ARRAY[]::int[]) LOOP
msg := 'band ' || bandmetadata.bandnum || ' of pixtype ' || bandmetadata.pixeltype || ' is ';
IF bandmetadata.isoutdb IS FALSE THEN
msg := msg || 'in-db ';
ELSE
msg := msg || 'out-db ';
END IF;
msg := msg || 'with ';
IF bandmetadata.nodatavalue IS NOT NULL THEN
msg := msg || 'NODATA value of ' || bandmetadata.nodatavalue;
ELSE
msg := msg || 'no NODATA value';
END IF;
msgset := msgset || (' ' || msg);
END LOOP;
RETURN array_to_string(msgset, E'\n');
END;
$span$
LANGUAGE 'plpgsql'
STABLE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST 100;
COMMENT ON FUNCTION public.st_summary(rast public.raster)
IS 'args: rast - Returns a text summary of the contents of the raster.';
This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 26/02/2014 11:51 |