]> granicus.if.org Git - postgis/commitdiff
Have ST_SplitGeometry return a collection of at most 2 elements (original part, cut...
authorSandro Santilli <strk@keybit.net>
Thu, 11 Mar 2010 20:19:14 +0000 (20:19 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 11 Mar 2010 20:19:14 +0000 (20:19 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5412 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_geos_split.c
regress/split.sql
regress/split_expected

index b8ed1f99cb2243f4bb32f06bfe935fc954b2378c..150b1362eee02c70b7e7cb281a2f019e137edbac 100644 (file)
@@ -84,10 +84,10 @@ lwline_split_by_point(LWLINE* lwline_in, LWPOINT* blade_in)
        /* TODO: check if either pa1 or pa2 are empty ? */
 
        components = lwalloc(sizeof(LWGEOM*)*2);
-       components[0] = (LWGEOM*)lwline_construct(lwline_in->SRID, NULL, pa1);
-       components[1] = (LWGEOM*)lwline_construct(lwline_in->SRID, NULL, pa2);
+       components[0] = (LWGEOM*)lwline_construct(-1, NULL, pa1);
+       components[1] = (LWGEOM*)lwline_construct(-1, NULL, pa2);
 
-       out = lwcollection_construct(MULTILINETYPE, lwline_in->SRID,
+       out = lwcollection_construct(COLLECTIONTYPE, lwline_in->SRID,
                NULL, 2, components);
 
        /* That's all folks */
index 7c9005d8488aafea606c41d4abede8dcde4344a2..be86daefa7d57d93cc4fadae3f4daa112e5ba8f0 100644 (file)
@@ -1,9 +1,9 @@
 -- Point on line
-select '1',st_astext(st_splitgeometry('LINESTRING(0 0, 10 0)', 'POINT(5 0)'));
+select '1',st_asewkt(st_splitgeometry('SRID=10;LINESTRING(0 0, 10 0)', 'POINT(5 0)'));
 
 -- Point on line boundary
-select '2',st_astext(st_splitgeometry('LINESTRING(0 0, 10 0)', 'POINT(10 0)'));
+select '2',st_asewkt(st_splitgeometry('SRID=10;LINESTRING(0 0, 10 0)', 'POINT(10 0)'));
 
 -- Point off line
-select '3',st_astext(st_splitgeometry('LINESTRING(0 0, 10 0)', 'POINT(5 1)'));
+select '3',st_asewkt(st_splitgeometry('SRID=10;LINESTRING(0 0, 10 0)', 'POINT(5 1)'));
 
index f6cc7bec98c6c38c1dcd203a0896b2cfd8788553..b5f1a0d73909d0d1e9d83cfee2817aa5524448e4 100644 (file)
@@ -1,3 +1,3 @@
-1|MULTILINESTRING((0 0,5 0),(5 0,10 0))
-2|LINESTRING(0 0,10 0)
-3|LINESTRING(0 0,10 0)
+1|SRID=10;GEOMETRYCOLLECTION(LINESTRING(0 0,5 0),LINESTRING(5 0,10 0))
+2|SRID=10;LINESTRING(0 0,10 0)
+3|SRID=10;LINESTRING(0 0,10 0)