[postgis-users] Break lines at intersections
Pavel Iacovlev
iacovlev.pavel at gmail.com
Wed Mar 28 06:43:31 PDT 2012
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 ?
On Wed, Mar 28, 2012 at 3:51 PM, Sandro Santilli <strk at keybit.net> wrote:
> On Wed, Mar 28, 2012 at 03:46:03PM +0300, Pavel Iacovlev wrote:
>> Not quite sure if I understand how ST_Node works, but I don't need all
>> the "line segments" of the linestring, I need the linestrings to brake
>> (divided into multiple linestrings while retaining the id attribute
>> preferably) where they intersect with other line in the same table.
>
> That's what ST_Node should give you, wrapped into collection.
> You could then use ST_Dump to explode the collection into
> components.
>
>> I have a attached a small image to represent what I need:
>> Line 1 - will be divided into 3 lines
>> Line 2 - will be divided into 2 lines
>> Line 3 - will be divided into 2 lines
>
> The single-line case is likely bogus unless you have GEOS-3.3.2 or higher.
>
> --strk;
>
> ,------o-.
> | __/ | Delivering high quality PostGIS 2.0 !
> | / 2.0 | http://strk.keybit.net - http://vizzuality.com
> `-o------'
>
> _______________________________________________
> 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