[postgis-users] Split Multistring on the_geom

Nicolas Ribot nicolas.ribot at gmail.com
Wed May 19 01:39:47 PDT 2010


>
> Hi,
>
> I would like to know if theres a postgis function (or the easist and
> effective way), that I can use to split an intersection o 2 multistrings, so
> I can have the geometric data of --the start and end nodes of both lines,
> and the new node created in the intersection,
>
> I'llbe really greatful,
>

Hello
Linear referencing functions may be useful in this case:
http://postgis.org/documentation/manual-1.5/reference.html#Linear_Referencing

A combination of the linestrings intersection and
st_line_locate_point, st_line_substring.
You will have to explode your multilinestrings into linestrings,
though, before using LR functions:

select st_astext(st_line_substring(geom1, 0, st_line_locate_point(
		geom1, st_intersection(geom1, geom2)
		)
	))
from
(select geometryN(geomfromtext('MULTILINESTRING((0 0, 6 0))', -1), 1) as geom1,
	geometryN(geomfromtext('MULTILINESTRING((3 3, 3 -1))', -1), 1) as
geom2) as foo;


Nicolas



More information about the postgis-users mailing list