<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    <br>
    As Sandro suggested, you can use ST_Azimuth.<br>
    <br>
    I tried on myself and came up which a result, there might be a
    shorter way.<br>
    <br>
    First, I created a view with the azimuth:<br>
    <br>
    CREATE OR REPLACE VIEW azimuth_view AS<br>
        SELECT
    id,ST_Azimuth(ST_PointN(wkb_geometry,1),ST_PointN(wkb_geometry,2))*180/pi()
    AS azimuth FROM mytable;<br>
    <br>
    This supposes you have only 1 segment on each line (of course!)<br>
    <br>
    Then, I test the difference between the azimuth and I give all
    parallels combinations with a given tolerance:<br>
    <br>
    CREATE OR REPLACE VIEW parallel_view AS<br>
        SELECT A1.id, A2.id AS parallel <br>
        FROM azimuth_view A1, azimuth_view A2<br>
        WHERE A1.id != A2.id<br>
          AND (abs(A1.azimuth-A2.azimuth)     <= tolerance <br>
           OR  abs(A1.azimuth-A2.azimuth)-360 <= tolerance <br>
           OR  abs(A1.azimuth-A2.azimuth)+360 <= tolerance );<br>
    <br>
    You can do similar for orthogonal lines then.<br>
    <br>
    PS: I tried with modulo but it does not accept double precision,
    only integer. Depending on wanted tolerance, this might not be
    enough!<br>
    <br>
    Cheers,<br>
    <br>
    Denis<br>
    <br>
    <br>
    On 02/06/2012 12:45 PM, Sindile Bidla wrote:
    <blockquote
cite="mid:CA+fb49YGC_p4dNXfGx93eXcKMQ8YD1DNVRybD5wh=+TGY2_+Pg@mail.gmail.com"
      type="cite">Anyone who can offer advice on on building a query to
      accomplish the following within the same line feature - roads:
      <div><br>
      </div>
      <div>1. create a new table or view of all line features that are
        parallel to a selected line feature within the same line feature</div>
      <div><br>
      </div>
      <div>2. create a new table or view of all line features that
        are perpendicular to a selected line feature within the same
        line feature</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <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>
    </blockquote>
  </body>
</html>