From 6dee7e44c73aa4c8461ceddc05951c59c687b4a8 Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Mon, 23 Jul 2012 17:49:31 +0000 Subject: [PATCH] Removed geometry-based ST_Touches for raster,geometry combinations. git-svn-id: http://svn.osgeo.org/postgis/trunk@10091 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 834853b64..07f992ef8 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -9085,12 +9085,6 @@ WHERE A.rid =2 ; Return true if the raster spatially touches a separate raster or geometry. This means that the raster/raster or raster/geometry combinations have at least one point in common but their interiors do not intersect. 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_Touches(), the test will operate in either raster-space or geometry-space. If ST_Touches(raster, ....), the test is in raster-space (the geometry is converted to a raster). If ST_Touches(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 e8c41f0f2..58155d820 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -3316,7 +3316,7 @@ CREATE OR REPLACE FUNCTION st_touches(rast1 raster, rast2 raster) COST 1000; ----------------------------------------------------------------------- --- ST_Touches(raster, geometry) in raster-space +-- ST_Touches(raster, geometry) ----------------------------------------------------------------------- CREATE OR REPLACE FUNCTION _st_touches(rast raster, geom geometry, nband integer DEFAULT NULL) @@ -3358,44 +3358,13 @@ CREATE OR REPLACE FUNCTION st_touches(rast raster, nband integer, geom geometry) COST 1000; ----------------------------------------------------------------------- --- ST_Touches(geometry, raster) in geometry-space +-- ST_Touches(geometry, raster) ----------------------------------------------------------------------- --- This function can not be STRICT -CREATE OR REPLACE FUNCTION _st_touches(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_Touches(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_Touches(geom, surface); - END IF; - - RETURN FALSE; - END; - $$ LANGUAGE 'plpgsql' IMMUTABLE - COST 1000; - -- This function can not be STRICT CREATE OR REPLACE FUNCTION st_touches(geom geometry, rast raster, nband integer DEFAULT NULL) RETURNS boolean AS - $$ SELECT $1 && $2::geometry AND _st_touches($1, $2, $3); $$ + $$ SELECT $1 && $2::geometry AND _st_touches($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 43ed88b39..cfda3c57c 100644 --- a/raster/rt_pg/rtpostgis_drop.sql.in.c +++ b/raster/rt_pg/rtpostgis_drop.sql.in.c @@ -350,3 +350,6 @@ DROP FUNCTION IF EXISTS st_bandsurface(raster, integer); -- function deprecated DROP FUNCTION IF EXISTS _st_overlaps(geometry, raster, integer); + +-- function deprecated +DROP FUNCTION IF EXISTS _st_touches(geometry, raster, integer); -- 2.40.0