[postgis-users] Break lines at intersections

Nicolas Ribot nicolas.ribot at gmail.com
Wed Mar 28 08:04:29 PDT 2012


On 28 March 2012 15:43, Pavel Iacovlev <iacovlev.pavel at gmail.com> wrote:
> Thank you for you help Sandro,
>
> As I understand something like this in theory:
> SELECT ST_Node(ST_Collect(the_geom)) FROM roads;
> Then I generate series from the result and using ST_Contains find to
> what initial "road" geometry the segment belongs and get it's gid or
> another attribute.
>
> Also you know (or maybe someone else knows) is it possible to
> accomplish this in PostGIS 1.5 ?
>

Hi,
Yes it is. Look at st_union() and st_dump.
st_union will cut the lines at their intersection points:

select st_astext((st_dump(st_union(geometry))).geom) from lines;

Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2012-03-28 at 5.03.32 PM.png
Type: image/png
Size: 10256 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120328/4e8c0fc4/attachment.png>


More information about the postgis-users mailing list