[postgis-users] Strange behaviour from ST_MakeValid when holes escape polygon outer ring

Craig de Stigter craig.destigter at koordinates.com
Tue Oct 11 13:24:14 PDT 2016


Hi folks

We've been using an internal geometry-fixing function for a long time, and
I'm looking into replacing it with ST_MakeValid().

I've come across a strange edge-case where ST_MakeValid() appears to
incorrectly treat polygons as a set of linework, rather than a shell and a
set of holes.

This means that when you give it a shape with a hole that partially escapes
the exterior ring, instead of that part getting discarded it forms the
outer ring of a new polygon, thus creating a multipolygon.

I expected it to take the outer ring and ST_Difference() all the inner
rings from the outer ring.

Here's some screenshots to demonstrate:

Actual:
https://drive.google.com/file/d/0By4X8bGnhCGET3h1UU1GOW1NTDA/view?usp=sharing
Expected:
https://drive.google.com/file/d/0By4X8bGnhCGEQjdzQlpsY0xlelk/view?usp=sharing

Would anyone who knows a bit more about ST_MakeValid() be able to comment
on this? (If I dug into the source and was able to submit a patch to fix
this, would it be likely to be accepted?)

-- 
Regards,
Craig

Developer
Koordinates

+64 21 256 9488 <+64%2021%20256%209488> / koordinates.com / @koordinates
<https://twitter.com/koordinates>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20161012/4d38e23c/attachment.html>


More information about the postgis-users mailing list