[postgis-commits] svn - r3630 - trunk/lwgeom

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Tue Feb 3 06:52:11 PST 2009


Author: robe
Date: 2009-02-03 06:52:11 -0800 (Tue, 03 Feb 2009)
New Revision: 3630

Modified:
   trunk/lwgeom/postgis.sql.in.c
Log:
#HISTORY: ST_MinimumBoundingCircle -- also change to support geometries with LINESTRING,POINT convex hulls

Modified: trunk/lwgeom/postgis.sql.in.c
===================================================================
--- trunk/lwgeom/postgis.sql.in.c	2009-02-03 14:21:25 UTC (rev 3629)
+++ trunk/lwgeom/postgis.sql.in.c	2009-02-03 14:52:11 UTC (rev 3630)
@@ -6132,8 +6132,13 @@
 
 	-- First compute the ConvexHull of the geometry
 	hull = ST_ConvexHull(inputgeom);
+	--A point really has no MBC
+	IF ST_GeometryType(hull) = 'ST_Point' THEN
+		RETURN hull;
+	END IF;
 	-- convert the hull perimeter to a linestring so we can manipulate individual points
-	ring = ST_ExteriorRing(hull);
+	--If its already a linestring force it to a closed linestring
+	ring = CASE WHEN ST_GeometryType(hull) = 'ST_LineString' THEN ST_AddPoint(hull, ST_StartPoint(hull)) ELSE ST_ExteriorRing(hull) END;
 
 	dist = 0;
 	-- Brute Force - check every pair



More information about the postgis-commits mailing list