<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Regina,</DIV>
<DIV>Thanks for taking the time to look at my question, the answer is yes to both of your assumpions:</DIV>
<DIV>1. Segments are cut at junctions.</DIV>
<DIV>2. I am trying to find contiguous segments from the intersection, but not for every intersection in the dataset, just for the intersection resulting from the streets that I specify, I'll use python to capture a pair of street names and generate the query dynamically.</DIV>
<DIV> </DIV>
<DIV>Thanks again,</DIV>
<DIV> </DIV>
<DIV>Andrew<BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> "Obe, Regina" <robe.dnd@cityofboston.gov><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> PostGIS Users Discussion <postgis-users@postgis.refractions.net><BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, December 15, 2008 8:58:30 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [postgis-users] Crossing roads<BR></FONT><BR>
<STYLE type=text/css>DIV {
MARGIN:0px;}
</STYLE>

<DIV dir=ltr align=left><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>Andrew,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>Not sure I understand your question.  Are you saying your street segments are cut such that they only connect at junctions.  Kind of like tiger tlids.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>And given each intersection, you are trying to find continguous segments from the intersection?</FONT></SPAN></DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>e.g.</FONT></SPAN></DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=459435013-15122008>-----------        -------------  ---------------   <FONT face=Arial color=#0000ff size=2>Intersection -------------------------- -------------------------------  -----------------</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>     t3                              t2                   t1                                        s3                 s4                               sn</FONT></SPAN></DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>                                                                                |a1</FONT></SPAN></DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>                                                                                |a2</FONT></SPAN></DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>                                                                                |an</FONT></SPAN></DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>So you would keep on collecting segments as long as they are connected to the previous ones?</FONT></SPAN></DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>Thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=459435013-15122008><FONT face=Arial color=#0000ff size=2>Regina</FONT></SPAN></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2></FONT><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> postgis-users-bounces@postgis.refractions.net [mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Andrew Ross<BR><B>Sent:</B> Saturday, December 13, 2008 11:05 AM<BR><B>To:</B> postgis-users@postgis.refractions.net<BR><B>Subject:</B> [postgis-users] Crossing roads<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV><BR>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hi Everybody,</SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I hope I'm posting to the right location (I just subscribed to this list).  I have sent this question before but have not seen it listed anywhere yet.<BR></SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><BR></SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">In any case, I have a road network in which all of the street segments are snapped together.  I need to group all of the line segments of two streets that cross each other (street 1 and street 2 as shown below) into 4 groups of segments defined as all of those located on either side of the intersection, </SPAN></FONT><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">(street segments A, street segments B, street segments C and street segments D</SPAN></FONT><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">, as shown at the bottom</SPAN></FONT><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">)</SPAN></FONT><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY:
 Arial">.  </SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Can anybody give me a high level idea of what functions / methods can be used to achieve this?  </SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I¢ve gotten as far as identifying the 4 segments actually connected to the intersection using the ST_Intersection function.  </SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">How would I get all other segments connected to these 4?  </SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Do I have to write a recursive function using ST_Touches ?  I¢d rather not if there is a more elegant way of doing this.</SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Thanks in advance,</SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Andrew</SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     1</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     1</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     1</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     1</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">            222222222222 X 22222222222222</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     1</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     1</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     1</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     1</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     A</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     A</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     A</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     A</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">            BBBBBBBBBBXCCCCCCCCCCC</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     D</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     D</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     D</SPAN></FONT></P>
<P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">                                     D</SPAN></FONT></P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<DIV>
<DIV style="TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR align=center width="100%" SIZE=3>
</SPAN></FONT></DIV></DIV></DIV></DIV><BR>
<P>
<HR SIZE=1>

<P></P>
<P><STRONG>The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer. </STRONG></P>
<P>
<HR SIZE=1>

<P></P>
<P><STRONG><FONT color=#339900 size=2>Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </P>
<P></FONT></STRONG></P></DIV></DIV></div><br>

      </body></html>