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

Craig de Stigter craig.destigter at koordinates.com
Tue Oct 11 15:54:38 PDT 2016


Aha, cheers. In fact I see that's mentioned in the docs too, but I hadn't
really understood what it meant until you pointed it out.

I'm curious if there's a situation in which that's a useful behaviour? It
strikes me as a very strange quirk...

On 12 October 2016 at 09:35, Komяpa <me at komzpa.net> wrote:

> ST_MakeValid tries to reconstruct geometry without losing vertices.
>
> The only sane way I can think of to do it without losing vertices is to
> stop treating the inner ring as inner ring and mark it as outer.
>
> If you need a geometry fixup function that does processing with losing
> vertices, ST_MakeValid isn't semantically what you need.
>
> вт, 11 окт. 2016 г. в 23:24, Craig de Stigter <
> craig.destigter at koordinates.com>:
>
>> 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>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users
>



-- 
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/39892d17/attachment.html>


More information about the postgis-users mailing list