Opened 8 years ago

Closed 7 years ago

## #400 closed defect (fixed)

# ST_Split

Reported by: | strk | Owned by: | strk |
---|---|---|---|

Priority: | medium | Milestone: | PostGIS 2.0.0 |

Component: | postgis | Version: | |

Keywords: | Cc: |

### Description

Split polygon by line, line by line, line by point. Returns components as either a set or collection.

### Change History (6)

### comment:1 Changed 8 years ago by

### comment:2 Changed 7 years ago by

Alright, here's the contract:

- Will split a poly by a line, a line by a line and a line by a point
- Will always return a COLLECTION of at most 2 elements: first element is what is left after the cut, second element is what was cut
- When you cut a line using a point, what's left is the initial portion of the line (from start to point)
- When you cut a poly or a line using a line what's left is arbitrarly taken as the cut-part which goes to the *left* of the cut line. This is for assonance with the word "left"

For now there's no support for multi-part geometries requiring cutting, but given this contract it might not be too hard to support (every non-cut geometry would go to the "left" part).

### comment:3 Changed 7 years ago by

Status: | new → assigned |
---|

Again, trying to have trac keep my formatting :/

- Will split a poly by a line, a line by a line and a line by a point - Will always return a COLLECTION of at most 2 elements: first element is what is left after the cut, second element is what was cut - When you cut a line using a point, what's left is the initial portion of the line (from start to point) - When you cut a poly or a line using a line what's left is arbitrarly taken as the cut-part which goes to the *left* of the cut line. This is for assonance with the word "left"

### comment:4 Changed 7 years ago by

Come again (sorry, but can't sleep till I succeed in getting it formatted right)

- Will split a poly by a line, a line by a line and a line by a point
- Will always return a COLLECTION of at most 2 elements: first element is what is left after the cut, second element is what was cut
- When you cut a line using a point, what's left is the initial portion of the line (from start to point)
- When you cut a poly or a line using a line what's left is arbitrarly taken as the cut-part which goes to the *left* of the cut line. This is for assonance with the word "left"

Thanks paul if this works :)

### comment:5 Changed 7 years ago by

Summary: | ST_SplitGeometry → ST_Split |
---|

Contract changed. We always return a collection but of as many elements as required to represent all components of output.

Currently line-by-point, line-by-line and poly-by-line splitting are supported and the function name is ST_Split.

Unsupported are all MULTI* and GEOMETRYCOLLECTION, but I'd like to add support for them too. The use case I have in mind is in conjunction to the ST_WrapX function proposed in ticket #454 (still not convinced about that function name:)

### comment:6 Changed 7 years ago by

Resolution: | → fixed |
---|---|

Status: | assigned → closed |

As of r5444 multi* and collections are also supported. Documentation and testcases are in place.

**Note:**See TracTickets for help on using tickets.

Ideas for the area/line case: http://trac.osgeo.org/postgis/wiki/UsersWikiSplitPolygonWithLineString