]> granicus.if.org Git - postgis/commitdiff
Removed geometry-based ST_Touches for raster,geometry combinations.
authorBborie Park <bkpark at ucdavis.edu>
Mon, 23 Jul 2012 17:49:31 +0000 (17:49 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Mon, 23 Jul 2012 17:49:31 +0000 (17:49 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10091 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference_raster.xml
raster/rt_pg/rtpostgis.sql.in.c
raster/rt_pg/rtpostgis_drop.sql.in.c

index 834853b6449c2b9cf2dfb36d24db08ab45a414a2..07f992ef8ef48fd5079f47f93d7d7259839c5bbb 100644 (file)
@@ -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.
                        </para>
 
-                       <note>
-                               <para>
-                                       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).
-                               </para>
-                       </note>
-
                        <note>
                                <para>
                                        This operand will make use of any indexes that may be available on the geometries / rasters.
index e8c41f0f2b9ffd9821269c11b504ea31c88636ce..58155d82087c2fd855adc691355ed040fbf96103 100644 (file)
@@ -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;
 
index 43ed88b396456ea7dc360e73cb1d0db75b172dc0..cfda3c57ca4fd3005d920aea74c08133cb61d4da 100644 (file)
@@ -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);