<div dir="ltr">You've got a visible example of why the canonical format of PostGIS is hexwbk, and not wkt, as it was in the 0.x versions. The human readable output is not quite exactly the same as the binary representation. <div>Since your geometry is just a hair's breadth from being invalid, maybe you should just accept some invalidity work: round your geometry to a tolerance with ST_SnapToGrid and then run ST_MakeValid on them to reform them into a more valid structure.</div><div>P.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 21, 2016 at 8:04 AM, Brian Peschel <span dir="ltr"><<a href="mailto:brianp@occinc.com" target="_blank">brianp@occinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Not sure I understand what is happening here.<br>
    <br>
    I have a geom:<br>
    <tt>select * from my_temp ;</tt><tt><br>
    </tt><tt>                                                                                                                                                                                               
      geom                                                                                                                                                                                               
    </tt><tt><br>
    </tt><tt>----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</tt><tt><br>
    </tt><tt> 0103000020AD100000010000000B0000006D514CC326AC57C029776BF2CF214440B742588D25AC57C0D7F84CF6CF2144406E514CC326AC57C029776BF2CF21444015CCF33B28AC57C084FAF1F2CF2144405748540328AC57C096010C70E621444090EC5BF720AC57C0D8C2876DE62144409C3B551921AC57C0AFFE19EFD8214440F555A82421AC57C0043D2F70D42144401508BE2F21AC57C07110D308D02144404E70FB2F21AC57C0C5BB6DF0CF2144406D514CC326AC57C029776BF2CF214440</tt><tt><br>
    </tt><br>
    Which PostGIS says is valid:<br>
    <tt>select st_isvalid(geom) from my_temp ;</tt><tt><br>
    </tt><tt> st_isvalid </tt><tt><br>
    </tt><tt>------------</tt><tt><br>
    </tt><tt> t</tt><tt><br>
    </tt><tt>(1 row)</tt><br>
    <br>
    I then convert to a format I can read:<br>
    <tt>select st_astext(geom) from my_temp ;</tt><tt><br>
    </tt><tt>                                                                                                                                                      
      st_astext                                                                                                                                                      
    </tt><tt><br>
    </tt><tt>-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</tt><tt><br>
    </tt><tt> POLYGON((</tt><tt><font color="#ff0000">-94.6898658986372
        40.2641585373625</font></tt><tt>,-94.689792 40.264159,</tt><tt><font color="#ff0000">-94.6898658986372 40.2641585373625</font></tt><tt>,-94.6899557
      40.2641586,-94.6899422 40.2648449,-94.6895121
      40.2648446,-94.6895202 40.2644328,-94.6895229
      40.2642956,-94.6895255428102 40.2641612082088,-94.6895256
      40.2641583,-94.6898658986372 40.2641585373625))</tt><tt><br>
    </tt><tt>(1 row)</tt><br>
    <br>
    But that isn't valid.  It is self intersecting (point 1 and point 3
    repeat).  And if I check the validity of the st_astext version:<br>
    <tt>select st_isvalid(geom),
      st_isvalid(st_geomfromtext(st_astext(geom), 4269)) from my_temp;</tt><tt><br>
    </tt><tt>NOTICE:  Self-intersection at or near point
      -94.689865898637194 40.264158537362498</tt><tt><br>
    </tt><tt> st_isvalid | st_isvalid </tt><tt><br>
    </tt><tt>------------+------------</tt><tt><br>
    </tt><tt> t          | f</tt><tt><br>
    </tt><tt>(1 row)</tt><tt><br>
    </tt><br>
    Any idea what is going on here and how can I prevent it?<br>
    <br>
    TIA!<span class="HOEnZb"><font color="#888888"><br>
    - brian<br>
  </font></span></div>

<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>