* ST_SplitGeometry
*
* Split polygon by line, line by line, line by point.
- * Returns components as a collection
+ * Returns at most components as a collection.
+ * First element of the collection is always the part which
+ * remains after the cut, while the second element is the
+ * part which has been cut out. We arbitrarely take the part
+ * on the *right* of cut lines as the part which has been cut out.
+ * For a line cut by a point the part which remains is the one
+ * from start of the line to the cut point.
+ *
*
* Author: Sandro Santilli <strk@keybit.net>
*
-- Point on line
select '1',st_asewkt(st_splitgeometry('SRID=10;LINESTRING(0 0, 10 0)', 'POINT(5 0)'));
+select '1.1',st_asewkt(st_splitgeometry('SRID=10;LINESTRING(10 0, 0 0)', 'POINT(5 0)'));
+
-- Point on line boundary
select '2',st_asewkt(st_splitgeometry('SRID=10;LINESTRING(0 0, 10 0)', 'POINT(10 0)'));
1|SRID=10;GEOMETRYCOLLECTION(LINESTRING(0 0,5 0),LINESTRING(5 0,10 0))
+1.1|SRID=10;GEOMETRYCOLLECTION(LINESTRING(10 0,5 0),LINESTRING(5 0,0 0))
2|SRID=10;GEOMETRYCOLLECTION(LINESTRING(0 0,10 0))
3|SRID=10;GEOMETRYCOLLECTION(LINESTRING(0 0,10 0))