]> granicus.if.org Git - postgis/commitdiff
Cleanup the GeometryClean function now that vertex checking is done better in ST_Make...
authorSandro Santilli <strk@keybit.net>
Sun, 21 Feb 2010 22:34:07 +0000 (22:34 +0000)
committerSandro Santilli <strk@keybit.net>
Sun, 21 Feb 2010 22:34:07 +0000 (22:34 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5282 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/postgis.sql.in.c

index f1fe7b4c8440e7b63972156a4f9edb6f2bcf852d..00506d8949081aa3fef93099b54f31c33d769643 100644 (file)
@@ -4014,7 +4014,7 @@ CREATE OR REPLACE FUNCTION ST_Union(geometry,geometry)
        AS 'MODULE_PATHNAME','geomunion'
        LANGUAGE 'C' IMMUTABLE STRICT;
 
--- ST_RemoveRepeatedPoint(in geometry)
+-- ST_RemoveRepeatedPoints(in geometry)
 --
 -- Removes duplicate vertices in input.
 -- Only checks consecutive points for lineal and polygonal geoms.
@@ -4077,12 +4077,6 @@ BEGIN
     RETURN gin;
   END IF;
 
-  -- Collect all distinct input points
-  SELECT INTO pin ST_Union(geom)
-    FROM (select (ST_DumpPoints(gin)).geom) as foo;
-
-  RAISE DEBUG 'ST_CleanGeometry: in points: %', ST_asText(pin);
-
   gout := ST_MakeValid(gin);
 
   -- Check dimensionality is the same as input
@@ -4092,26 +4086,18 @@ BEGIN
     RETURN NULL;
   END IF;
 
-  -- Collect all distinct output points and check they contain
-  -- all points from the input set
-
-  SELECT INTO pout ST_Union(geom)
-    FROM (select (ST_DumpPoints(gout)).geom) as foo;
-
-  RAISE DEBUG 'ST_CleanGeometry: out points: %', ST_asText(pout);
-
-  pdif := ST_Difference(pin, pout);
-  IF NOT ST_isEmpty(pdif) THEN
-    RAISE NOTICE 'ST_CleanGeometry: dropped vertices: %', ST_asText(pdif);
+  -- Check that the output is not a collection if the input wasn't
+  IF ST_GeometryType(gin) != 'ST_GeometryCollection' AND ST_GeometryType(gout) = 'ST_GeometryCollection' THEN
+    RAISE NOTICE 'ST_CleanGeometry: mixed-type output (%) from single-type input (%)',
+      ST_GeometryType(gout), ST_GeometryType(gin);
     RETURN NULL;
   END IF;
 
   -- Force right-hand-rule (will only affect polygons)
-
   gout := ST_ForceRHR(gout);
 
-  -- Remove repeated duplicated points 
-  -- TODO!!
+  -- Remove repeated duplicated points ?
+  -- gout = ST_RemoveRepeatedPoints(gout);
 
   RETURN gout;