]> granicus.if.org Git - postgis/commitdiff
Added force_collection(geometry)
authorDavid Blasby <dblasby@gmail.com>
Thu, 28 Jun 2001 23:53:54 +0000 (23:53 +0000)
committerDavid Blasby <dblasby@gmail.com>
Thu, 28 Jun 2001 23:53:54 +0000 (23:53 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12 b70326c6-7e19-0410-871a-916f4a2858ee

postgis.h
postgis.sql.in
postgis_fn.c

index aa820a55bb5ea7f9d5e88fea35c4974429df479d..3d749f2549137df74ab2063c52e4057674015dc9 100644 (file)
--- a/postgis.h
+++ b/postgis.h
@@ -344,6 +344,7 @@ Datum asbinary_simple(PG_FUNCTION_ARGS);
 
 Datum force_2d(PG_FUNCTION_ARGS);
 Datum force_3d(PG_FUNCTION_ARGS);
+Datum force_collection(PG_FUNCTION_ARGS);
 
 Datum combine_bbox(PG_FUNCTION_ARGS);
 
index 181b76ffeda5f55dd05dc745a9907f76348b9407..6f077dbad7a7106f4ff06fc626382dbb76d205db 100644 (file)
@@ -290,6 +290,10 @@ CREATE FUNCTION force_2d(GEOMETRY) RETURNS GEOMETRY
 CREATE FUNCTION force_3d(GEOMETRY) RETURNS GEOMETRY
         AS '@MODULE_FILENAME@'  LANGUAGE 'c' with (isstrict);
 
+-------- cause geometry to be represented as a geometry collection
+
+CREATE FUNCTION force_collection(GEOMETRY) RETURNS GEOMETRY
+        AS '@MODULE_FILENAME@'  LANGUAGE 'c' with (isstrict);
 
 
 -------- GiST support functions
index 312bd9fc60768f9604bb3c911cffd5fea606d837..4ca4cd3e089bd1c423a3f774fd7123b04f3dd358 100644 (file)
@@ -1421,8 +1421,16 @@ Datum geometryn_collection(PG_FUNCTION_ARGS)
 }
 
 
+//force the geometry to be a geometrycollection type
 
+PG_FUNCTION_INFO_V1(force_collection);
+Datum force_collection(PG_FUNCTION_ARGS)
+{
+               GEOMETRY                      *geom = (GEOMETRY *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 
+       geom->type = COLLECTIONTYPE;
+       PG_RETURN_POINTER(geom);
+}