<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Thank you very much! I'll try with this
      approach.<br>
      <br>
      Regards,<br>
      <br>
      Paolo<br>
      <br>
      Il 17/06/2015 18:24, Rémi Cura ha scritto:<br>
    </div>
    <blockquote
cite="mid:CAJvUf_uOJfLRnpuADdJz9Ukv9P19x=9QEJg8TqxL1W8DkZBknA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:monospace,monospace">Hm,<br>
        </div>
        <div class="gmail_default"
          style="font-family:monospace,monospace">quite easy normally
          (method proposed above won't work).<br>
        </div>
        <div class="gmail_default"
          style="font-family:monospace,monospace">First break your
          polygon into segment, for instance with <br>
          <a moz-do-not-send="true"
href="https://github.com/Remi-C/PPPP_utilities/blob/master/postgis/rc_DumpSegments.sql">https://github.com/Remi-C/PPPP_utilities/blob/master/postgis/rc_DumpSegments.sql</a><br>
        </div>
        <div class="gmail_default"
          style="font-family:monospace,monospace">Then, for each
          segment, compute the angle between first and last point, using
          <code class=""><span class="">ST_Azimuth, and st_pointN.<br>
              <br>
            </span></code></div>
        <div class="gmail_default"
          style="font-family:monospace,monospace"><code class=""><span
              class="">Now, keep the segment where the abs(angle) is
              between pi/2<br>
               -tolerancy and pi/2+tolerancy<br>
              ( you should add a tolerancy , nobody will be facing
              exactly north)</span><b class="">.<br>
            </b></code></div>
        <div class="gmail_default"
          style="font-family:monospace,monospace"><code class=""><b
              class="">Now simply sum the st_length of found segments.<br>
              <br>
            </b></code></div>
        <div class="gmail_default"
          style="font-family:monospace,monospace"><code class=""><b
              class="">Cheers,<br>
            </b></code></div>
        <div class="gmail_default"
          style="font-family:monospace,monospace"><code class=""><b
              class="">Rémi-C<br>
            </b></code></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2015-06-17 17:40 GMT+02:00 Komяpa <span
            dir="ltr"><<a moz-do-not-send="true"
              href="mailto:me@komzpa.net" target="_blank">me@komzpa.net</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Hello,
              <div><br>
              </div>
              <div>you can apply ST_ForceRHR, break your polygons into
                segments and sum length of the ones that go from right
                to left, that is, where ST_X(ST_StartPoint(geom)) <
                ST_X(ST_StartPoint(geom)).</div>
              <div><br>
              </div>
              <div>That's basically visibility problem, been there
                somewhere around <a moz-do-not-send="true"
href="https://github.com/Komzpa/Mapnik-Sheets/blob/master/3d-buildings/3dbuil.xml#L95"
                  target="_blank">https://github.com/Komzpa/Mapnik-Sheets/blob/master/3d-buildings/3dbuil.xml#L95</a><br>
              </div>
            </div>
            <div class="gmail_extra">
              <div>
                <div class="h5"><br>
                  <div class="gmail_quote">2015-06-17 18:12 GMT+03:00
                    Paolo Crosato <span dir="ltr"><<a
                        moz-do-not-send="true"
                        href="mailto:paolo.crosato@targaubiest.com"
                        target="_blank">paolo.crosato@targaubiest.com</a>></span>:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
                      <br>
                      I have a set of 2d polygons representing
                      buildings. For each one, I have to find the lenght
                      of the edges that look towards north.<br>
                      <br>
                      Here <a moz-do-not-send="true"
                        href="http://imgur.com/HgpO2yH" rel="noreferrer"
                        target="_blank">http://imgur.com/HgpO2yH</a>
                      there is a small picture with a test case, I have
                      to compute the lenght of the red edges.<br>
                      <br>
                      Has anybody any suggestion on how to do this in
                      postgis?<br>
                      <br>
                      Thanks for any input,<br>
                      <br>
                      Regards<span><font color="#888888"><br>
                          <br>
                          -- <br>
                          Paolo Crosato<br>
                          Software engineer/Custom Solutions<br>
                          e-mail: <a moz-do-not-send="true"
                            href="mailto:paolo.crosato@targaubiest.com"
                            target="_blank">paolo.crosato@targaubiest.com</a><br>
                          <br>
_______________________________________________<br>
                          postgis-users mailing list<br>
                          <a moz-do-not-send="true"
                            href="mailto:postgis-users@lists.osgeo.org"
                            target="_blank">postgis-users@lists.osgeo.org</a><br>
                          <a moz-do-not-send="true"
                            href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users"
                            rel="noreferrer" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
                        </font></span></blockquote>
                  </div>
                  <br>
                  <br clear="all">
                  <div><br>
                  </div>
                </div>
              </div>
              <span class="HOEnZb"><font color="#888888">-- <br>
                  <div>Darafei "Komяpa" Praliaskouski<br>
                    OSM BY Team - <a moz-do-not-send="true"
                      href="http://openstreetmap.by/" target="_blank">http://openstreetmap.by/</a><br>
                    <a moz-do-not-send="true"
                      href="mailto:xmpp%3Ame@komzpa.net" target="_blank">xmpp:me@komzpa.net</a>
                    mailto:<a moz-do-not-send="true"
                      href="mailto:me@komzpa.net" target="_blank">me@komzpa.net</a><br>
                  </div>
                </font></span></div>
            <br>
            _______________________________________________<br>
            postgis-users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users"
              rel="noreferrer" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Paolo Crosato
Software engineer/Custom Solutions

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