[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    [postgis-users] Geometry validation
From:       Alain Benard <alain.benard () nancy ! inra ! fr>
Date:       2015-11-16 7:52:16
Message-ID: 56498B30.7040302 () nancy ! inra ! fr
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,
with a shapefile data i make a postgis layer and i have a lot of invalid 
geometry when I use st_isvalid. I test the reason (autointersect or 
polygon not close) and i analyse what the function ST_MakeValid do for 
the correction.
In general the solution is simple and i can understand what ST_Makevalid 
do :

  * for a polygon not closed the function add a new point at the end of
    ring : this point is the same as the first of the ring ... This is
    understandable
  * some time this new point is going with autointersect and the
    function make another ring (polygon) ...

For a small number of cases I don't understand :

with geom_ok as (select st_makevalid(ST_Polygon(ST_GeomFromText('LINESTRING
(517246.650250374 6235655.09571606,
517254.869230517 6235654.08725248,
517254.964217886 6235654.06182677,
517255.08007872 6235654.04585861,
517265.885662183 6235651.10620124,
517271.091480721 6235649.9650496,
517278.239223978 6235650.18059235,
517286.15483325 6235651.52643379,
517286.418409635 6235651.54758047,
517286.462909663 6235651.53834437,
517286.501499884 6235651.5445841,
517291.645862764 6235651.21595168,
517291.731398726 6235651.19570766,
517291.943664438 6235651.1664528,
517297.364469745 6235649.69172334,
517297.555997067 6235649.62541147,
517298.039378564 6235649.29659159,
517298.161447001 6235649.15597989,
517300.141608557 6235646.56599323,
517300.340293418 6235646.21783214,
517300.449586735 6235645.64351765,
517300.330781156 6235645.07109566,
517300.001963754 6235644.58771219,
517299.513193998 6235644.26695803,
517298.938882652 6235644.15766508,
517298.366463412 6235644.2764722,
517297.883081918 6235644.60529208,
517297.761013481 6235644.74590379,
517296.088719977 6235646.93320907,
517291.303418718 6235648.23504973,
517286.484854463 6235648.54286948,
517278.639238552 6235647.20892859,
517278.463942498 6235647.19486462,
517278.433254764 6235647.18841113,
517270.996710657 6235646.96415949,
517270.969372019 6235646.96928768,
517270.939118061 6235646.96353028,
517270.63072415 6235646.99822966,
517265.207547013 6235648.18702783,
517265.164368112 6235648.20078286,
517265.135049002 6235648.20482368,
517254.397374526 6235651.12600644,
517246.678311041 6235652.07313058,
517246.675983156 6235652.09463206,
517246.111239149 6235652.95717014,
517246.650250376 6235655.09571606,
517246.650250374 6235655.09571606
)
'), 2154))as poly_ok)
select st_asewkt(poly_ok) from geom_ok

After the correction there is a polygon, a line and a multipoint. I can 
understand the line (/with only 2 points : the system consider the last 
point and the intersection point are aligned with the first probably 
because the distance is very very small/) but I don't understand the 
multipoint : all point in this multipoint are in the polygon. I think it 
is a bug but i prefer explain in this list before reporting.
Thanks for your help.
Alain.

[Attachment #5 (text/html)]

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    with a shapefile data i make a postgis layer and i have a lot of
    invalid geometry when I use st_isvalid. I test the reason
    (autointersect or polygon not close) and i analyse what the function
    ST_MakeValid do for the correction.<br>
    In general the solution is simple and i can understand what
    ST_Makevalid do :<br>
    <ul>
      <li>for a polygon not closed the function add a new point at the
        end of ring : this point is the same as the first of the ring
        ... This is understandable</li>
      <li>some time this new point is going with autointersect and the
        function make another ring (polygon) ...</li>
    </ul>
    <p>For a small number of cases I don't understand :<br>
    </p>
    <p>with geom_ok as (select
      st_makevalid(ST_Polygon(ST_GeomFromText('LINESTRING<br>
      (517246.650250374 6235655.09571606,<br>
      517254.869230517 6235654.08725248,<br>
      517254.964217886 6235654.06182677,<br>
      517255.08007872 6235654.04585861,<br>
      517265.885662183 6235651.10620124,<br>
      517271.091480721 6235649.9650496,<br>
      517278.239223978 6235650.18059235,<br>
      517286.15483325 6235651.52643379,<br>
      517286.418409635 6235651.54758047,<br>
      517286.462909663 6235651.53834437,<br>
      517286.501499884 6235651.5445841,<br>
      517291.645862764 6235651.21595168,<br>
      517291.731398726 6235651.19570766,<br>
      517291.943664438 6235651.1664528,<br>
      517297.364469745 6235649.69172334,<br>
      517297.555997067 6235649.62541147,<br>
      517298.039378564 6235649.29659159,<br>
      517298.161447001 6235649.15597989,<br>
      517300.141608557 6235646.56599323,<br>
      517300.340293418 6235646.21783214,<br>
      517300.449586735 6235645.64351765,<br>
      517300.330781156 6235645.07109566,<br>
      517300.001963754 6235644.58771219,<br>
      517299.513193998 6235644.26695803,<br>
      517298.938882652 6235644.15766508,<br>
      517298.366463412 6235644.2764722,<br>
      517297.883081918 6235644.60529208,<br>
      517297.761013481 6235644.74590379,<br>
      517296.088719977 6235646.93320907,<br>
      517291.303418718 6235648.23504973,<br>
      517286.484854463 6235648.54286948,<br>
      517278.639238552 6235647.20892859,<br>
      517278.463942498 6235647.19486462,<br>
      517278.433254764 6235647.18841113,<br>
      517270.996710657 6235646.96415949,<br>
      517270.969372019 6235646.96928768,<br>
      517270.939118061 6235646.96353028,<br>
      517270.63072415 6235646.99822966,<br>
      517265.207547013 6235648.18702783,<br>
      517265.164368112 6235648.20078286,<br>
      517265.135049002 6235648.20482368,<br>
      517254.397374526 6235651.12600644,<br>
      517246.678311041 6235652.07313058,<br>
      517246.675983156 6235652.09463206,<br>
      517246.111239149 6235652.95717014,<br>
      517246.650250376 6235655.09571606,<br>
      517246.650250374 6235655.09571606<br>
      )<br>
      '), 2154))as poly_ok)<br>
      select st_asewkt(poly_ok) from geom_ok</p>
    After the correction there is a polygon, a line and a multipoint. I
    can understand the line (<small><i>with only 2 points : the system
        consider the last point and the intersection point are aligned
        with the first probably because the distance is very very small</i></small>)
    but I don't understand the multipoint : all point in this multipoint
    are in the polygon. I think it is a bug but i prefer explain in this
    list before reporting.<br>
    Thanks for your help.<br>
    Alain.
  </body>
</html>

["alain_benard.vcf" (text/x-vcard)]
[Attachment #7 (text/plain)]

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/postgis-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic