[postgis-users] What Does ST_Split Cut Closed Linestrings at the "Origin"?

Bronson Arbitrario bronson.arbitrario at commuterama.com
Fri Sep 7 19:17:45 PDT 2012


Using this statement,
SELECT ST_AsGeoJSON(ST_Split(ST_GeomFromText('LINESTRING(0 0,2 0,2 2,0
2,0 0)'), ST_GeomFromText('LINESTRING(0 2,2 0)')))

I get this,
{"type":"GeometryCollection","geometries":[{"type":"LineString","coordinates":[[0,0],[2,0]]},{"type":"LineString","coordinates":[[2,0],[2,2],[0,2]]},{"type":"LineString","coordinates":[[0,2],[0,0]]}]}

Since this is basically a square being cut with a diagonal, I'm
expecting only two linestrings. However, I end up with three
linestrings, with two of them "split" at (0,0). ST_Split seems to
always split the first/last point of a closed linestring.

Does anyone know why this happens?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120907/17d0d34b/attachment.html>


More information about the postgis-users mailing list