<div dir="ltr">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.<div><br></div><div>I'm curious if there's a situation in which that's a useful behaviour? It strikes me as a very strange quirk...</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 October 2016 at 09:35, Komяpa <span dir="ltr"><<a href="mailto:me@komzpa.net" target="_blank">me@komzpa.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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" target="_blank">craig.destigter@koordinates.<wbr>com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr" class="m_7140635769007187356gmail_msg">Hi folks<div class="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div><div class="m_7140635769007187356gmail_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="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div><div class="m_7140635769007187356gmail_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="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div><div class="m_7140635769007187356gmail_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="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div><div class="m_7140635769007187356gmail_msg">I expected it to take the outer ring and ST_Difference() all the inner rings from the outer ring.</div><div class="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div><div class="m_7140635769007187356gmail_msg">Here's some screenshots to demonstrate:</div><div class="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div><div class="m_7140635769007187356gmail_msg">Actual: <a href="https://drive.google.com/file/d/0By4X8bGnhCGET3h1UU1GOW1NTDA/view?usp=sharing" class="m_7140635769007187356gmail_msg" target="_blank">https://drive.google.com/file/<wbr>d/<wbr>0By4X8bGnhCGET3h1UU1GOW1NTDA/<wbr>view?usp=sharing</a><br class="m_7140635769007187356gmail_msg"></div><div class="m_7140635769007187356gmail_msg">Expected: <a href="https://drive.google.com/file/d/0By4X8bGnhCGEQjdzQlpsY0xlelk/view?usp=sharing" class="m_7140635769007187356gmail_msg" target="_blank">https://drive.google.com/file/<wbr>d/<wbr>0By4X8bGnhCGEQjdzQlpsY0xlelk/<wbr>view?usp=sharing</a><br clear="all" class="m_7140635769007187356gmail_msg"><div class="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div><div class="m_7140635769007187356gmail_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="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div>-- <br class="m_7140635769007187356gmail_msg"><div class="m_7140635769007187356m_1752773630719486597gmail_signature m_7140635769007187356gmail_msg"><div dir="ltr" class="m_7140635769007187356gmail_msg"><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="m_7140635769007187356gmail_msg">Regards,</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="m_7140635769007187356gmail_msg">Craig</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="m_7140635769007187356gmail_msg">Developer</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="m_7140635769007187356gmail_msg">Koordinates</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="m_7140635769007187356gmail_msg"><br class="m_7140635769007187356gmail_msg"></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:12px" class="m_7140635769007187356gmail_msg"><a href="tel:+64%2021%20256%209488" style="color:rgb(17,85,204)" class="m_7140635769007187356gmail_msg" target="_blank">+64 21 256 9488</a> / <a href="http://koordinates.com/" style="color:rgb(17,85,204)" class="m_7140635769007187356gmail_msg" target="_blank">koordinates.com</a> / <a href="https://twitter.com/koordinates" style="color:rgb(17,85,204)" class="m_7140635769007187356gmail_msg" target="_blank">@<wbr>koordinates</a></div></div></div>
</div></div></div></div>
______________________________<wbr>_________________<br class="m_7140635769007187356gmail_msg">
postgis-users mailing list<br class="m_7140635769007187356gmail_msg">
<a href="mailto:postgis-users@lists.osgeo.org" class="m_7140635769007187356gmail_msg" target="_blank">postgis-users@lists.osgeo.org</a><br class="m_7140635769007187356gmail_msg">
<a href="http://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" class="m_7140635769007187356gmail_msg" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/postgis-users</a></blockquote></div>
<br>______________________________<wbr>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/postgis-users</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Regards,</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Craig</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><br></div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Developer</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Koordinates</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><br></div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><a href="tel:+64%2021%20256%209488" style="color:rgb(17,85,204)" target="_blank">+64 21 256 9488</a> / <a href="http://koordinates.com/" style="color:rgb(17,85,204)" target="_blank">koordinates.com</a> / <a href="https://twitter.com/koordinates" style="color:rgb(17,85,204)" target="_blank">@koordinates</a></div></div></div>
</div>