From 84c6206bbeee413055487cd5099f9b81603a6897 Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Mon, 23 Jul 2012 17:49:24 +0000 Subject: [PATCH] Removed vector-space (geometry-based) variants of ST_Overlaps. Only raster-space versions remain. git-svn-id: http://svn.osgeo.org/postgis/trunk@10090 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_raster.xml | 6 ----- raster/rt_pg/rtpostgis.sql.in.c | 37 +++------------------------- raster/rt_pg/rtpostgis_drop.sql.in.c | 3 +++ 3 files changed, 6 insertions(+), 40 deletions(-) diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index 1f550af1b..834853b64 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -8961,12 +8961,6 @@ WHERE A.rid =2 ; Return true if the raster spatially overlaps a separate raster or geometry. This means that the raster/raster or raster/geometry combinations intersect but one does not completely contain the other. If the band number is not provided (or set to NULL), only the convex hull of the raster is considered in the test. If the band number is provided, only those pixels with value (not NODATA) are considered in the test. - - - Depending on the order that the raster and geometry is passed to ST_Overlaps(), the test will operate in either raster-space or geometry-space. If ST_Overlaps(raster, ....), the test is in raster-space (the geometry is converted to a raster). If ST_Overlaps(geometry, ...), the test is in geometry-space (the raster is converted to a set of pixel polygons). - - - This operand will make use of any indexes that may be available on the geometries / rasters. diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index 3f875fc3a..e8c41f0f2 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -3241,7 +3241,7 @@ CREATE OR REPLACE FUNCTION st_overlaps(rast1 raster, rast2 raster) COST 1000; ----------------------------------------------------------------------- --- ST_Overlaps(raster, geometry) in raster-space +-- ST_Overlaps(raster, geometry) ----------------------------------------------------------------------- CREATE OR REPLACE FUNCTION _st_overlaps(rast raster, geom geometry, nband integer DEFAULT NULL) @@ -3283,44 +3283,13 @@ CREATE OR REPLACE FUNCTION st_overlaps(rast raster, nband integer, geom geometry COST 1000; ----------------------------------------------------------------------- --- ST_Overlaps(geometry, raster) in geometry-space +-- ST_Overlaps(geometry, raster) ----------------------------------------------------------------------- --- This function can not be STRICT -CREATE OR REPLACE FUNCTION _st_overlaps(geom geometry, rast raster, nband integer DEFAULT NULL) - RETURNS boolean AS $$ - DECLARE - convexhull geometry; - hasnodata boolean := TRUE; - surface geometry; - BEGIN - convexhull := ST_ConvexHull(rast); - IF nband IS NOT NULL THEN - SELECT CASE WHEN bmd.nodatavalue IS NULL THEN FALSE ELSE NULL END INTO hasnodata FROM ST_BandMetaData(rast, nband) AS bmd; - END IF; - - IF ST_Overlaps(geom, convexhull) IS NOT TRUE THEN - RETURN FALSE; - ELSEIF nband IS NULL OR hasnodata IS FALSE THEN - RETURN TRUE; - END IF; - - -- get band polygon - surface := ST_Polygon(rast, nband); - - IF surface IS NOT NULL THEN - RETURN ST_Overlaps(geom, surface); - END IF; - - RETURN FALSE; - END; - $$ LANGUAGE 'plpgsql' IMMUTABLE - COST 1000; - -- This function can not be STRICT CREATE OR REPLACE FUNCTION st_overlaps(geom geometry, rast raster, nband integer DEFAULT NULL) RETURNS boolean AS - $$ SELECT $1 && $2::geometry AND _st_overlaps($1, $2, $3); $$ + $$ SELECT $1 && $2::geometry AND _st_overlaps($2, $1, $3); $$ LANGUAGE 'sql' IMMUTABLE COST 1000; diff --git a/raster/rt_pg/rtpostgis_drop.sql.in.c b/raster/rt_pg/rtpostgis_drop.sql.in.c index 66401f213..43ed88b39 100644 --- a/raster/rt_pg/rtpostgis_drop.sql.in.c +++ b/raster/rt_pg/rtpostgis_drop.sql.in.c @@ -347,3 +347,6 @@ DROP FUNCTION IF EXISTS st_pixelaspolygons(raster, integer); -- function deprecated DROP FUNCTION IF EXISTS st_bandsurface(raster, integer); + +-- function deprecated +DROP FUNCTION IF EXISTS _st_overlaps(geometry, raster, integer); -- 2.40.0