[postgis-users] merging dual carriageway motorway lines
Stephen Woodbridge
woodbri at swoodbridge.com
Mon Dec 19 06:21:14 PST 2011
On 12/19/2011 7:12 AM, Lauri Kajan wrote:
> Hi all,
>
> I have a road network loaded to PostGIS.
> Now I'm trying to find a way to merge parallel lines of a dual
> carriageway motorway to single a line?
> Or is there any?
Lauri,
I do not think there is any automated way to do this, but here are some
thoughts on how you might be able to do this.
1. collect the dual carriageway segments based on a common attribute
like name
2. for each segment, extract the points of the linestring and tag them
with the segments uid, you also might want to generate extra points
along this linestring and tag them with the segments uid also
3. for each point find the nearest point not on this segments uid, and
probably not on a connected segment within some limit distance and
insert a point that is the midpoint between the reference point and the
nearest point into a combine_point table.
4. stringify the combined_point table by connecting nearest points
within some limit distance.
Problems that you might encounter:
a. ramps backs that might get included by mistake.
b. loops or near loops like mountain switch that might confuse the stringify
c. combine carriageway does not follow mid-point path of dual carriage
because not all segments were selected or there were not enough points
generated along the original paths to compute the mid point path.
I have not tried to do this but it is how I would tackle the problem.
Others might have some good ideas also.
Thanks,
-Steve
More information about the postgis-users
mailing list