[postgis-users] Fwd: cut lines with points

Stephen Woodbridge woodbri at swoodbridge.com
Wed Mar 14 16:58:37 PDT 2012

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)));

This assumes your data is int SRID:4326, change as appropriate.

I have not tried this but give it a try and see how it works.

-Steve W

On 3/14/2012 4:59 PM, Pedro Costa wrote:
> I forget the image...
> -------- Mensagem Original --------
> Assunto: 	cut lines with points
> Data: 	Wed, 14 Mar 2012 20:59:14 +0000
> De: 	Pedro Costa <pedrocostaarma at sapo.pt> <mailto:pedrocostaarma at sapo.pt>
> Para: 	postgis-users at postgis.refractions.net
> <mailto:postgis-users at postgis.refractions.net>
> Hello to all,
> This is my first mail to this list.
> I have to do one thing and i need help for solving that fastly.
> I have points and lines and I intend to cut the lines based on points.
> Does anyone have any idea how to fix this quickly?
> Attached is a picture to illustrate the problem.
> thank you
> Pedro
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

More information about the postgis-users mailing list