[postgis-users] Fwd: cut lines with points
strk at keybit.net
Thu Mar 15 00:59:16 PDT 2012
On Wed, Mar 14, 2012 at 07:58:37PM -0400, Stephen Woodbridge wrote:
> You might want to look at the book: "PostGIS In Action" pg 225 has a
> function to cut a linestring at point junctions.
> Basically, you want to take your two points and construction a line like:
> select astext(setsrid(makeline(pnt1, pnt2), 4326));
> then get a collection of pieces of myline after we subtract your new
> line from it:
> select astext(st_difference(myline, setsrid(makeline(pnt1, pnt2), 4326)));
In 2.0 there's also ST_Split for that purpose.
For the cut-line-by-line case it should be faster than st_difference.
Semantic is slightly different in that you get a collection out of
ST_Split, not a multiline.
| __/ | Delivering high quality PostGIS 2.0 !
| / 2.0 | http://strk.keybit.net - http://vizzuality.com
More information about the postgis-users