pggeodb-preprod.nancy.inra.fr/db_onf_gde - db_onf_gde on pggeodb-preprod.nancy.inra.fr
Previous topic Chapter index Next topic

Function: st_neighborhood

 

 

Schema

public

 

Owner

postgres

 

Descriptions

args: rast, bandnum, pt, distanceX, distanceY, exclude_nodata_value=true - Returns a 2-D double precision array of the non-NODATA values around a given bands pixel specified by either a columnX and rowY or a geometric point expressed in the same spatial reference coordinate system as the raster.

 

Options

Option

Value

Returns

double precision []

Language

plpgsql

Parameters

rast public.raster

band integer

pt public.geometry

distancex integer

distancey integer

exclude_nodata_value boolean = true

 

Definition

CREATE OR REPLACE FUNCTION public.st_neighborhood (
 rast public.raster,
 band integer,
 pt public.geometry,
 distancex integer,
 distancey integer,
 exclude_nodata_value boolean = true
)
RETURNS double precision [] AS
$span$
DECLARE

wx double precision;
wy double precision;
rtn double precision[][];
BEGIN
IF
(st_geometrytype($3) != 'ST_Point') THEN
RAISE EXCEPTION
'Attempting to get the neighbor of a pixel with a non-point geometry';
END IF;

IF ST_SRID(rast) != ST_SRID(pt) THEN
RAISE EXCEPTION
'Raster and geometry do not have the same SRID';
END IF;

wx := st_x($3);
wy := st_y($3);

SELECT public._ST_neighborhood(
$1, $2,
st_worldtorastercoordx(rast, wx, wy),
st_worldtorastercoordy(rast, wx, wy),
$4, $5,
$6
) INTO rtn;
RETURN rtn;
END;
$span$
LANGUAGE
'plpgsql'
IMMUTABLE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST
100;

COMMENT ON FUNCTION public.st_neighborhood(rast public.raster, band integer, pt public.geometry, distancex integer, distancey integer, exclude_nodata_value boolean)
IS 'args: rast, bandnum, pt, distanceX, distanceY, exclude_nodata_value=true - Returns a 2-D double precision array of the non-NODATA values around a given bands pixel specified by either a columnX and rowY or a geometric point expressed in the same spatial reference coordinate system as the raster.';

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 07/12/2018 13:23
Previous topic Chapter index Next topic