[postgis-users] Merging lines - one on another

Andrea Peri aperi2007 at gmail.com
Sat Jan 21 05:19:06 PST 2012


>I am using QGIS with PostGIS with the data that represents some cables
>on the terrain. There are some segments where the cables are drawn one
>near another (for example about 30 cm apart) and they even cross
>sometimes. My goal is to get the trenches, so to "merge" those parts
>of lines, that are separated for example for 50 cm at most into one so
>that later I can get the length of the trenches required (in the cases
>where lines are separated for less than 50 cm, of course one trench
>will be planned and it should be in the middle of both lines with the
>defined width).
>
>What would be the best procedure to follow to achieve this? I have
>tried ST_Equals and ST_HausdorffDistance, but I can't get on the right
>track ...
Hi, if I understand your need.
I guess you could use the
ST_SharedPaths  that is available in postgis 2.0.

http://www.postgis.org/documentation/manual-svn/ST_SharedPaths.html

and the ST_Snap to set the minimum distance.

ST_SharedPath(geom1, ST_Snap(geom1, geom2, 0.5))

-- 

-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120121/ab6d8217/attachment.html>


More information about the postgis-users mailing list