<!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">
    That's what I thought ... my morning coffee hadn't kicked in yet :)<br>
    <br>
    It still looks like PostGIS might benefit from a
    ShiftCoordinates(linearring geometry) function to solve this
    particular problem.<br>
    -- Kevin<br>
    <br>
    On 10/22/2010 10:45 AM, David William Bitner wrote:
    <blockquote
      cite="mid:AANLkTi=ef9r1Rn=7OoEM8mwEvxVNPzG17PNxWutBxDVH@mail.gmail.com"
      type="cite">D-P simplification is not going to modify your
      start/end points. For a bit of reference on the Douglas-Peuker
      simplification algorithm, see <a moz-do-not-send="true"
href="http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm">http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm</a><br>
      <br>
      <div class="gmail_quote">On Fri, Oct 22, 2010 at 11:13 AM, Kevin
        Neufeld <span dir="ltr"><<a moz-do-not-send="true"
            href="mailto:kneufeld@refractions.net">kneufeld@refractions.net</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          I don't see any pdf posted, but that's ok, I get the idea.<br>
          <br>
          Isn't that interesting.  To me, this looks like a robustness
          issue with ST_Simplify.  Here, the starting point of the
          polygon's exterior ring is not on the corner.<br>
          <br>
          select<br>
           st_astext(<br>
             st_simplify(<br>
               'POLYGON ((<br>
                 25 300,<br>
                 275 300,<br>
                 300 300,It<br>
                 300 275,<br>
                 300 25,<br>
                 300 0,<br>
                 275 0,<br>
                 25 0,<br>
                 0 0,<br>
                 0 25,<br>
                 0 275,<br>
                 0 300,<br>
                 25 300<br>
                ))', 1<br>
             )<br>
           );<br>
                             st_astext<br>
          --------------------------------------------------<br>
           POLYGON((25 300,300 300,300 0,0 0,0 300,25 300))<br>
          (1 row)<br>
          <br>
          I don't know why, but I too was expecting to see something
          like:<br>
          POLYGON (( 0 300, 300 300, 300 0, 0 0, 0 300 ))<br>
          <br>
          You almost could use a function that shifts the ordinates in
          the exterior linear ring ... you could probably put something
          together fairly quickly in plpgsql (extract the exterior ring,
          use ST_GetPointN and ST_SetPointN, and rebuild the polygon).<br>
          Once shifted, the starting ordinance would be on the corner
          and the (25 300) vertex would disappear with a rerun of
          ST_Simplify.<br>
          <br>
          JTS has the same issue.<br>
          <font color="#888888">
            <br>
            -- Kevin</font>
          <div>
            <div class="h5"><br>
              <br>
              <br>
              On 10/22/2010 2:33 AM, lplateandy wrote:<br>
              <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
                0.8ex; border-left: 1px solid rgb(204, 204, 204);
                padding-left: 1ex;">
                Hi Kevin,<br>
                <br>
                Hopefully the attached (hopefully) PDF will help to show
                what i mean.<br>
                <br>
                In producing the PDF i think i can see why the issue
                happens. It seems that<br>
                the start and end point of the polygon geometery are the
                node i was hoping<br>
                might be removed during the simplify process.<br>
                <br>
                Not sure if there is a way around this?<br>
                <br>
                I do realise there are ways for a simple rectangle etc
                to fix this but the<br>
                example is mainly for illustration as the issue is a
                problem in more complex<br>
                geometries.<br>
                <br>
                Thanks<br>
                <br>
                Andy<br>
                <br>
                <br>
                Kevin Neufeld wrote:<br>
                <blockquote class="gmail_quote" style="margin: 0pt 0pt
                  0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);
                  padding-left: 1ex;">
                  Hi Andy,<br>
                  <br>
                  Can you post a small example?<br>
                  -- Kevin<br>
                  <br>
                  <br>
                  On 10/21/2010 10:02 AM, lplateandy wrote:<br>
                  <blockquote class="gmail_quote" style="margin: 0pt 0pt
                    0pt 0.8ex; border-left: 1px solid rgb(204, 204,
                    204); padding-left: 1ex;">
                    Hi,<br>
                    <br>
                    I have, in the simplest example, a square polygon of
                    1 by 1 kilometer<br>
                    size<br>
                    with nodes every 25 meters.<br>
                    <br>
                    I can use ST_Simplify (the_geom,5) to remove most of
                    the points.<br>
                    <br>
                    However, for some reason i end up with the four
                    corner nodes and a fifth<br>
                    node 25m clockwise from the top left corner.<br>
                    <br>
                    In itself, this would be fine - 5 nodes is better
                    than 160.<br>
                    <br>
                    However, on some of the polygons, there are more
                    complex boundaries which<br>
                    i<br>
                    wish to smooth out using simplify. I would do this
                    with  ST_Simplify<br>
                    (the_geom,26) example - going over the minimum 25
                    metres between  any<br>
                    nodes.<br>
                    <br>
                    In the example of the square with 5 nodes, the
                    problem i find then is<br>
                    that<br>
                    the top left node is removed and the one 25m
                    clockwise remains. The<br>
                    result<br>
                    is that i no longer have a 1km square but sloping
                    Western boundary<br>
                    correctly<br>
                    going 1km North South but incorrectly veering across
                    25m to the East.<br>
                    <br>
                    Is there a way to remove the stray node so i am more
                    likely to maintain<br>
                    my<br>
                    overall polygon shape. I did try
                    st_simplifiypreservetopology but saw no<br>
                    noticeable difference.<br>
                    <br>
                    Hope that makes sense, any help much appreciated<br>
                    <br>
                    Andy<br>
                  </blockquote>
                  _______________________________________________<br>
                  postgis-users mailing list<br>
                  <a moz-do-not-send="true"
                    href="mailto:postgis-users@postgis.refractions.net"
                    target="_blank">postgis-users@postgis.refractions.net</a><br>
                  <a moz-do-not-send="true"
                    href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
                    target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
                  <br>
                  <br>
                </blockquote>
                <a moz-do-not-send="true"
                  href="http://old.nabble.com/file/p30027046/ST_simplify_issue.pdf"
                  target="_blank">http://old.nabble.com/file/p30027046/ST_simplify_issue.pdf</a><br>
                ST_simplify_issue.pdf<br>
              </blockquote>
              _______________________________________________<br>
              postgis-users mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:postgis-users@postgis.refractions.net"
                target="_blank">postgis-users@postgis.refractions.net</a><br>
              <a moz-do-not-send="true"
                href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
                target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      ************************************<br>
      David William Bitner<br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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>