[postgis-users] Geometry validation

Alain Benard alain.benard at nancy.inra.fr
Sun Nov 15 23:52:16 PST 2015


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20151116/4d2411b7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alain_benard.vcf
Type: text/x-vcard
Size: 292 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20151116/4d2411b7/attachment.vcf>


More information about the postgis-users mailing list