[postgis-users] MultiLineString element to LineStrings

CYW cyw at dls.net
Fri Jun 2 15:56:55 PDT 2006


One of my data sets represents road centerlines. I ported it to the database
from shapefiles. Looking at the data I noticed one MultiLineString was used
for each road centerline. However, these MultiLineStrings all contain only
one element.

For example, if a road starts from (x1 y1) and ends at (xn yn), the
MultiLineString for it is like: 

	MultiLineString((x1 y1, x2 y2, ..... ,xn yn))

I need to be able to operate most of the time on a small portion of the road
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.

I am not sure if PostGIS allows me to query for a portion of an element of a
MultiLineString.

If not, I will need to break the MultiLinsString element into multiple
standalone LingStrings and save them in a different table, and I will need
also to capture and maintain the ordinal sequence of each LineString. 

I know I can write code to read and re-write the shp2pgsql generated sql
files to accomplish it,  but I guess there should be some existing tools or
PostGIS functions that help.

Thanks,
_cyw_





More information about the postgis-users mailing list