<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">I hope this is the right place to ask my question. I am using Shapely (GEOS
</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">3.3.0)</span><span lang="EN-US"> for doing a lot of intersections and buffering. I have encountered the following polygon:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">POLYGON ((495500.0008984859 6223520.993661864, 495499.998 6223520.995448768, 495499.9991735771 6223527.855730382, 495508.4863142541 6223531.706871153, 495530.2685512748
 6223543.411751036, 495533.1580739201 6223544.947487216, 495533.8227791181 6223543.611840623, 495533.8271434258 6223543.603092512, 495555.6344791899 6223499.999, 495566.8171459202 6223499.999, 495566.8180398509 6223500.000448206, 495566.1117119509 6223501.409196244,
 495542.7750432596 6223548.072535053, 495526.8506947843 6223580.070632624, 495529.2135856081 6223581.293180954, 495552.9615536986 6223534.554188457, 495570.1400217356 6223499.999, 495581.3075270238 6223499.999, 495581.3084224826 6223500.000445144, 495561.9082049726
 6223539.026180848, 495561.8885137878 6223539.065359981, 495538.1146364022 6223585.855345234, 495559.0058384891 6223596.461268372, 495566.4481611441 6223599.999096851, 495566.4477318175 6223600.001, 495543.8828814158 6223600.000891673, 495533.6582439464 6223594.810107598,
 495531.1272425454 6223600.001, 495600.0010000134 6223600.001, 495600.002 6223599.999999792, 495600 6223593.009925384, 495596.8509020228 6223591.430463607, 495596.8495582865 6223591.430912227, 495596.1490985376 6223592.839558984, 495590.0299959367 6223589.770009149,
 495575.7599193477 6223582.619950288, 495574.7599693871 6223581.849986448, 495573.6199312546 6223580.849924827, 495572.4699504239 6223579.319921299, 495571.6599650297 6223577.669868131, 495571.4399859799 6223576.499942598, 495571.3299971888 6223574.919921184,
 495571.5300424019 6223572.699865821, 495572.0800108417 6223571.299956108, 495578.5195385296 6223558.440899175, 495578.1804384738 6223558.269103024, 495595.8708982405 6223522.980438616, 495599.9998027192 6223525.048014081, 495600.0012504738 6223525.047119915,
 495599.9999999871 6223499.998, 495530.7043992468 6223499.998449264, 495516.0786580448 6223529.078217097, 495500.0008984859 6223520.993661864))<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">According to QGIS it has a self-intersection at (495566.447732, 6223600.001) and the polygon is the result of previous intersections with other valid geometry.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">I am trying to buffer the polygon 0.001 meter (no segments) to avoid the self-intersection. But instead I end up with this MultiPolygon:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">MULTIPOLYGON (((495555.6332172451 6223499.999287644, 495566.8184538786 6223499.999215126, 495566.8179968625 6223499.99847474, 495566.8171459202 6223499.998,
 495555.6344791899 6223499.998, 495555.6335848061 6223499.9985527, 495555.6332172451 6223499.999287644)), ((495570.1388087373 6223499.999193599, 495581.3087785234 6223499.999121181, 495581.3083770663 6223499.998473286, 495581.3075270238 6223499.998, 495570.1400217356
 6223499.998, 495570.1391262832 6223499.998554843, 495570.1388087373 6223499.999193599)), ((495566.4489825341 6223600, 495543.878915958 6223600, 495543.8824287364 6223600.001783347, 495543.8828814111 6223600.001891674, 495566.4477318127 6223600.002, 495566.4487073044
 6223600.001220058, 495566.4489825341 6223600)))<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">Though it is valid it only represents the part of the polygon I would like to avoid, but in this case increase to ensure validity on the expense of a slightly
 increased area.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">Is the MultiPolygon the intended result of the specified operation?<o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">Are there any methods to better ensure validity of geometries resulting from the various geometric functions?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">Kind regards, Casper<o:p></o:p></span></p>
</div>
</body>
</html>