[postgis-users] MultiLineString element to LineStrings

CYW cyw at dls.net
Mon Jun 5 08:45:21 PDT 2006

Thank you, Steffen.

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Steffen
Sent: Saturday, June 03, 2006 3:08 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] MultiLineString element to LineStrings


>         MultiLineString((x1 y1, x2 y2, ..... ,xn yn))
> I need to be able to operate most of the time on a small portion of the
> based on some queries, e.g., get road segments that are within a certain
> range of a point. By segment, I mean a line connecting two consecutive
> points.

Depending on what you need exactly, the following might work:

line_substring(geometryn('MULTILINESTRING((1 1,0 0))',1),0,0.5)

The measures 0 and 0.5 can be obtained e.g. through line_locate_point().
0 is the beginning of the line.
0.5 is the middle of the line
1 is the end of the line.

If you would like to always use the vertices of the line (without
you should look at the NumPoints() and PointN() functions.

The PostgreSQL function generate_series() will allow you to loop over
several points
in an SQL statement. If that is not sufficient, you may have to create an


postgis-users mailing list
postgis-users at postgis.refractions.net

More information about the postgis-users mailing list