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

Function: _st_intersects

 

 

Schema

public

 

Owner

postgres

 

Descriptions

There is no description for function _st_intersects

 

Options

Option

Value

Returns

boolean

Language

plpgsql

Parameters

geom public.geometry

rast public.raster

nband integer = NULL::integer

 

Definition

CREATE OR REPLACE FUNCTION public._st_intersects (
 geom public.geometry,
 rast public.raster,
 nband integer = NULL::integer
)
RETURNS boolean AS
$span$
DECLARE

hasnodata boolean := TRUE;
_geom geometry;
BEGIN
IF
ST_SRID(rast) != ST_SRID(geom) THEN
RAISE EXCEPTION
'Raster and geometry do not have the same SRID';
END IF;

_geom := ST_ConvexHull(rast);
IF nband IS NOT NULL THEN
SELECT CASE WHEN
bmd.nodatavalue IS NULL THEN FALSE ELSE NULL END INTO hasnodata FROM public.ST_BandMetaData(rast, nband) AS bmd;
END IF;

IF ST_Intersects(geom, _geom) IS NOT TRUE THEN
RETURN FALSE
;
ELSEIF nband IS NULL OR hasnodata IS FALSE THEN
RETURN TRUE
;
END IF;

SELECT public.ST_Collect(t.geom) INTO _geom FROM public.ST_PixelAsPolygons(rast, nband) AS t;
RETURN public.ST_Intersects(geom, _geom);
END;
$span$
LANGUAGE
'plpgsql'
IMMUTABLE
CALLED ON NULL INPUT
SECURITY INVOKER
COST
1000;

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