Schema
Owner
postgres
Descriptions
There is no description for function st_intersection
Options
Option | Value |
---|---|
Returns |
Set of public.geomval |
Language |
|
Parameters |
geomin public.geometry rast public.raster band integer = 1 |
Definition
CREATE OR REPLACE FUNCTION public.st_intersection (
geomin public.geometry,
rast public.raster,
band integer = 1
)
RETURNS SETOF public.geomval AS
$span$
DECLARE
intersects boolean := FALSE;
BEGIN
intersects := ST_Intersects(geomin, rast, band);
IF intersects THEN
-- Return the intersections of the geometry with the vectorized parts of
-- the raster and the values associated with those parts, if really their
-- intersection is not empty.
RETURN QUERY
SELECT
intgeom,
val
FROM (
SELECT
ST_Intersection((gv).geom, geomin) AS intgeom,
(gv).val
FROM ST_DumpAsPolygons(rast, band) gv
WHERE ST_Intersects((gv).geom, geomin)
) foo
WHERE NOT ST_IsEmpty(intgeom);
ELSE
-- If the geometry does not intersect with the raster, return an empty
-- geometry and a null value
RETURN QUERY
SELECT
emptygeom,
NULL::float8
FROM ST_GeomCollFromText('GEOMETRYCOLLECTION EMPTY', ST_SRID($1)) emptygeom;
END IF;
END;
$span$
LANGUAGE 'plpgsql'
IMMUTABLE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST 100 ROWS 1000;
This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 07/12/2018 13:23 |