<div dir="ltr">ST_MakeValid tries to reconstruct geometry without losing vertices.<br><br>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.<div><br></div><div>If you need a geometry fixup function that does processing with losing vertices, ST_MakeValid isn't semantically what you need.</div></div><br><div class="gmail_quote"><div dir="ltr">вт, 11 окт. 2016 г. в 23:24, Craig de Stigter <<a href="mailto:craig.destigter@koordinates.com">craig.destigter@koordinates.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Hi folks<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">We've been using an internal geometry-fixing function for a long time, and I'm looking into replacing it with ST_MakeValid().</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">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.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">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.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I expected it to take the outer ring and ST_Difference() all the inner rings from the outer ring.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Here's some screenshots to demonstrate:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Actual: <a href="https://drive.google.com/file/d/0By4X8bGnhCGET3h1UU1GOW1NTDA/view?usp=sharing" class="gmail_msg" target="_blank">https://drive.google.com/file/d/0By4X8bGnhCGET3h1UU1GOW1NTDA/view?usp=sharing</a><br class="gmail_msg"></div><div class="gmail_msg">Expected: <a href="https://drive.google.com/file/d/0By4X8bGnhCGEQjdzQlpsY0xlelk/view?usp=sharing" class="gmail_msg" target="_blank">https://drive.google.com/file/d/0By4X8bGnhCGEQjdzQlpsY0xlelk/view?usp=sharing</a><br clear="all" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">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?)</div><div class="gmail_msg"><br class="gmail_msg"></div>-- <br class="gmail_msg"><div class="m_1752773630719486597gmail_signature gmail_msg"><div dir="ltr" class="gmail_msg"><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="gmail_msg">Regards,</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="gmail_msg">Craig</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="gmail_msg"><br class="gmail_msg"></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="gmail_msg">Developer</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="gmail_msg">Koordinates</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="gmail_msg"><br class="gmail_msg"></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="gmail_msg"><a href="tel:+64%2021%20256%209488" style="color:rgb(17,85,204)" class="gmail_msg" target="_blank">+64 21 256 9488</a> / <a href="http://koordinates.com/" style="color:rgb(17,85,204)" class="gmail_msg" target="_blank">koordinates.com</a> / <a href="https://twitter.com/koordinates" style="color:rgb(17,85,204)" class="gmail_msg" target="_blank">@koordinates</a></div></div></div>
</div></div>
_______________________________________________<br class="gmail_msg">
postgis-users mailing list<br class="gmail_msg">
<a href="mailto:postgis-users@lists.osgeo.org" class="gmail_msg" target="_blank">postgis-users@lists.osgeo.org</a><br class="gmail_msg">
<a href="http://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote></div>