[postgis-users] st_astext() created invalid

Brian Peschel brianp at occinc.com
Thu Jul 21 08:04:12 PDT 2016


Not sure I understand what is happening here.

I have a geom:
select * from my_temp ;
geom
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  0103000020AD100000010000000B0000006D514CC326AC57C029776BF2CF214440B742588D25AC57C0D7F84CF6CF2144406E514CC326AC57C029776BF2CF21444015CCF33B28AC57C084FAF1F2CF2144405748540328AC57C096010C70E621444090EC5BF720AC57C0D8C2876DE62144409C3B551921AC57C0AFFE19EFD8214440F555A82421AC57C0043D2F70D42144401508BE2F21AC57C07110D308D02144404E70FB2F21AC57C0C5BB6DF0CF2144406D514CC326AC57C029776BF2CF214440

Which PostGIS says is valid:
select st_isvalid(geom) from my_temp ;
  st_isvalid
------------
  t
(1 row)

I then convert to a format I can read:
select st_astext(geom) from my_temp ;
st_astext
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  POLYGON((-94.6898658986372 40.2641585373625,-94.689792 
40.264159,-94.6898658986372 40.2641585373625,-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))
(1 row)

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:
select st_isvalid(geom), st_isvalid(st_geomfromtext(st_astext(geom), 
4269)) from my_temp;
NOTICE:  Self-intersection at or near point -94.689865898637194 
40.264158537362498
  st_isvalid | st_isvalid
------------+------------
  t          | f
(1 row)

Any idea what is going on here and how can I prevent it?

TIA!
- brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160721/bf7c6cf4/attachment.html>


More information about the postgis-users mailing list