[postgis-devel] ST_GeometrySplit

strk strk at keybit.net
Thu Mar 11 07:03:42 PST 2010


On Wed, Mar 10, 2010 at 11:49:18AM -0800, Chris Hodgson wrote:
> It would be nice if the results were separated into "left" and "right". 
> So you might return a geometrycollection which always contains 2 
> components, the first one always being the left side and the second 
> being the right. The geometries in the collection would have the 
> appropriate type, perhaps minimized to the "lowest" applicable type 
> (line vs. multiline or poly vs. multipoly).

2 components only seems to be the most wanted, so I'd go for it.

COLLECTION vs. ARRAY vs. SET I'm still thinking about.
Surely if order is important a simple GEOMETRY SET wouldn't be
appropriate as SETs are unordered by definition.

> Right-side vs left side can be ambiguous too... an example is a circle 
> or spiral that is split by a line on only one side. Perhaps a 3rd 
> component to the resulting collection?

For a LINESTRING only the segment being split (or the two segments
being split on their conjuncting nodes) would be taken in consideration.

Rather, in a multipoly or multiline we'll  have to put the not-being-cut
parts either in one or the other component. Could be we always take
the first component as being the "left over" and the second component
as being the "cut-away" part and hard-code the fact that you always 
"cut-away" the part on the right.

Example 1:

    ^
    |    +---+
 +-----+ |   |
 |  |  | +---+
 +-----+
    |
         +---+
 +--+    |   |
 |  |    +---+  THIS IS THE "left over"
 +--+

    +--+      
    |  |        THIS IS THE "cut-away"
    +--+

Example 2:

     
    |    +---+
 +-----+ |   |
 |  |  | +---+
 +-----+
    |
    v

         +---+
    +--+ |   |
    |  | +---+  THIS IS THE "left over"
    +--+
              
 +--+         
 |  |           THIS IS THE "cut-away"
 +--+


--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html



More information about the postgis-devel mailing list