Schema
Owner
postgres
Descriptions
There is no description for function st_max4ma
Options
Option | Value |
---|---|
Returns |
double precision |
Language |
|
Parameters |
value double precision [] pos integer [] variadic userargs text [] = NULL::text[] |
Definition
CREATE OR REPLACE FUNCTION public.st_max4ma (
value double precision [],
pos integer [],
variadic userargs text [] = NULL::text[]
)
RETURNS double precision AS
$span$
DECLARE
_value double precision[][][];
max double precision;
x int;
y int;
z int;
ndims int;
BEGIN
max := '-Infinity'::double precision;
ndims := array_ndims(value);
-- add a third dimension if 2-dimension
IF ndims = 2 THEN
_value := public._ST_convertarray4ma(value);
ELSEIF ndims != 3 THEN
RAISE EXCEPTION 'First parameter of function must be a 3-dimension array';
ELSE
_value := value;
END IF;
-- raster
FOR z IN array_lower(_value, 1)..array_upper(_value, 1) LOOP
-- row
FOR y IN array_lower(_value, 2)..array_upper(_value, 2) LOOP
-- column
FOR x IN array_lower(_value, 3)..array_upper(_value, 3) LOOP
IF _value[z][y][x] IS NULL THEN
IF array_length(userargs, 1) > 0 THEN
_value[z][y][x] = userargs[array_lower(userargs, 1)]::double precision;
ELSE
CONTINUE;
END IF;
END IF;
IF _value[z][y][x] > max THEN
max := _value[z][y][x];
END IF;
END LOOP;
END LOOP;
END LOOP;
IF max = '-Infinity'::double precision THEN
RETURN NULL;
END IF;
RETURN max;
END;
$span$
LANGUAGE 'plpgsql'
IMMUTABLE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100;
This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23 |