]> granicus.if.org Git - postgis/commitdiff
#2692, Curve output support in ST_Collect
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 22 Jul 2015 15:29:46 +0000 (15:29 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 22 Jul 2015 15:29:46 +0000 (15:29 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@13829 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_functions_basic.c
regress/tickets.sql
regress/tickets_expected

index 9ab8f41c6271e0ee28ce4ef626b12d9e7fcee0ce..09fc1984863738b0c2f5cfffe02037d4797cec03 100644 (file)
@@ -1248,17 +1248,11 @@ Datum LWGEOM_collect_garray(PG_FUNCTION_ARGS)
                /* Output type not initialized */
                if ( ! outtype )
                {
-                       /* Input is single, make multi */
-                       if ( ! lwtype_is_collection(intype) ) 
-                               outtype = lwtype_get_collectiontype(intype);
-                       /* Input is multi, make collection */
-                       else 
-                               outtype = COLLECTIONTYPE;
+                       outtype = lwtype_get_collectiontype(intype);
                }
-
                /* Input type not compatible with output */
                /* make output type a collection */
-               else if ( outtype != COLLECTIONTYPE && intype != outtype-3 )
+               else if ( outtype != COLLECTIONTYPE && lwtype_get_collectiontype(intype) != outtype )
                {
                        outtype = COLLECTIONTYPE;
                }
index 8373721beae405aa7ab90f1c232f0117cbb3f2fa..4c99a953358124c8ed7305aa5470154b82d669c0 100644 (file)
@@ -861,6 +861,15 @@ DROP TABLE images;
 
 -- SELECT '#2672', ST_AsTWKBAgg(null::geometry, 3);
 
+-- #2692
+WITH v AS ( SELECT 'CIRCULARSTRING(0 0, 1 1, 2 2)'::geometry AS g FROM generate_series(1,3) ) 
+SELECT '#2692a', ST_AsText(st_collect(g)) FROM v;
+WITH v AS ( SELECT 'COMPOUNDCURVE((0 0, 1 1), CIRCULARSTRING(1 1, 1 2, 3 2))'::geometry AS g FROM generate_series(1,3) ) 
+SELECT '#2692b', ST_AsText(st_collect(g)) FROM v;
+WITH v AS ( SELECT 'TRIANGLE((0 0, 1 1, 1 0, 0 0))'::geometry AS g FROM generate_series(1,3) ) 
+SELECT '#2692c', ST_AsText(st_collect(g)) FROM v;
+
+
 SELECT '#2704', ST_AsText(ST_GeomFromGML('<?xml version="1.0"?>
 <gml:Polygon xmlns:gml="http://www.opengis.net/gml/3.2"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
index e85cca4f87857b9836ab13e4e1bf8122b65bd476..ae4b42dd25a579f87ec3d78139a22367895a5bbc 100644 (file)
@@ -256,6 +256,9 @@ ERROR:  invalid GML representation
 #2168|5340.76237395|5340.76237395|0
 #2556|47409|20623
 #2556|1|0
+#2692a|MULTICURVE(CIRCULARSTRING(0 0,1 1,2 2),CIRCULARSTRING(0 0,1 1,2 2),CIRCULARSTRING(0 0,1 1,2 2))
+#2692b|MULTICURVE(COMPOUNDCURVE((0 0,1 1),CIRCULARSTRING(1 1,1 2,3 2)),COMPOUNDCURVE((0 0,1 1),CIRCULARSTRING(1 1,1 2,3 2)),COMPOUNDCURVE((0 0,1 1),CIRCULARSTRING(1 1,1 2,3 2)))
+#2692c|TIN(((0 0,1 1,1 0,0 0)),((0 0,1 1,1 0,0 0)),((0 0,1 1,1 0,0 0)))
 #2704|POLYGON((0 0,0 1,1 1,1 0,0 0))
 #2712|LINESTRING EMPTY
 #2717|POINT(-1 -1)|POINT(3 1)|POINT(-1 -1)|POINT(1 1)|POINT(1 1)|POINT(2 2)|POINT(3 1)