<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi<br>
<br>
I have created source and target with "assign_vertex_id" function from
pgRouting.<br>
Now, the query... I know that I need less than 3 times the same point
number (source or target) and then, the same source or target number
has to be on different ID = merge theses lines<br>
merge1.jpg attached<br>
<br>
Thank you for your help<br>
<br>
Martin F<br>
<br>
Sufficool, Stanley a écrit :
<blockquote
 cite="mid:C2F174F99918D54CA2A96E57C5079B6F018276E8@sbc-exmsg2.sbcounty.gov"
 type="cite">
  <pre wrap="">My first crack at the issue was to use a 3 time self join on table2.st_startpoint and table1.st_endpoint with a 3rd table to check that no other 3rd line shared the endpoint. This ensured proper directionality, but there was no function as st_linemerge(table1.geom, table2.geom). Maybe I missed something. That query also would only have merged 2 coincident lines at a time.


  </pre>
  <blockquote type="cite">
    <pre wrap="">-----Original Message-----
From: <a class="moz-txt-link-abbreviated" href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a> 
[<a class="moz-txt-link-freetext" href="mailto:postgis-users-bounces@postgis.refractions.net">mailto:postgis-users-bounces@postgis.refractions.net</a>] On 
Behalf Of Kevin Neufeld
Sent: Wednesday, October 07, 2009 8:40 AM
To: <a class="moz-txt-link-abbreviated" href="mailto:martin.fafard@geoprojection.com">martin.fafard@geoprojection.com</a>; PostGIS Users Discussion
Subject: Re: [postgis-users] Merge lines


Correct.  It looks like the below query will return 
coincident lines along contiguous sections of 3 or more (it also 
assumes your network is properly directionalized).

This is a problem of transitive closure.  I once solved this 
iteratively by first finding all the degree-2 nodes in my 
network, then one node at at time, merging the two lines that 
share the node.

A modern approach might be to solve this using PostgreSQL's 
new recursive SQL syntax. Cheers, Kevin

Martin Fafard wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Stanley

Thank you
But your query merge two contiguous lines but not 3 or more 
      </pre>
    </blockquote>
    <pre wrap="">contiguous
    </pre>
    <blockquote type="cite">
      <pre wrap="">lines...

Martin

Sufficool, Stanley a écrit :
      </pre>
      <blockquote type="cite">
        <pre wrap="">Does this look correct?

select st_linemerge(st_collect(cs1.the_geom))
from (
        select the_geom, st_startpoint(cs_s.the_geom) as linepoint
        from mylinetable cs_s
        UNION ALL 
        select the_geom, st_endpoint(cs_e.the_geom) as linepoint
        from mylinetable cs_e

) as cs1
group by linepoint
having count(*) = 2

        </pre>
      </blockquote>
    </blockquote>
    <pre wrap="">_______________________________________________
postgis-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>

    </pre>
    <pre wrap="">
<hr size="4" width="90%">

No virus found in this incoming message.
Checked by AVG - <a class="moz-txt-link-abbreviated" href="http://www.avg.com">www.avg.com</a> 
Version: 8.5.421 / Virus Database: 270.14.5/2419 - Release Date: 10/07/09 05:18:00

    </pre>
  </blockquote>
</blockquote>
</body>
</html>