<div dir="ltr">Thanks for the bug report.  I have replied on the original sf ticket:  <a href="https://github.com/r-spatial/sf/issues/1781#issuecomment-916260161">https://github.com/r-spatial/sf/issues/1781#issuecomment-916260161</a><div><br></div><div>Quoted here for the benefit of this list:</div><div><br></div><div><p style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI Variable","Segoe UI",system-ui,ui-sans-serif,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;margin-top:0px">There is a bug in GEOS 3.9.0 which causes overlay to essentially drop straight lines if they are axis-parallel. It very much sounds like this is what you are seeing. The bug was <a href="https://git.osgeo.org/gitea/geos/geos/commit/acefb04aac1352add0449bc7e6f38af5093134ce" rel="nofollow" style="box-sizing:border-box;background-color:transparent;text-decoration-line:none">fixed</a> in GEOS 3.9.1.</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI Variable","Segoe UI",system-ui,ui-sans-serif,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">If it's not possible to upgrade, two workarounds are:</p><ul style="box-sizing:border-box;padding-left:2em;margin-top:0px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI Variable","Segoe UI",system-ui,ui-sans-serif,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;margin-bottom:0px"><li style="box-sizing:border-box;margin-left:0px">rotate the lines a very small amount</li><li style="box-sizing:border-box;margin-top:0.25em;margin-left:0px">use <code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:11.9px;padding:0.2em 0.4em;margin:0px;border-radius:6px">intersects</code> to detect if a line is wholly inside a polygon, and if so just include it in the result directly</li></ul></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 9, 2021 at 3:21 AM Laura Marshall <<a href="mailto:lhm@st-andrews.ac.uk">lhm@st-andrews.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Dear list,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I use GEOS 3.9.0 via an R library (sf). I have been trying to find the intersection between groups of lines and a polygon / multipolygon.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I have realised that updating the packages on my machine has resulted in some strange intersection results on Windows machines (and only Windows - works on mac and ubuntu). The sf update which introduced the issue was also associated with a change in GEOS versions,
 upgrading from 3.8.0 to 3.9.0 and the suspicion is that it is something in GEOS rather than the sf R library. 
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I have searched the tickets but could not see any issues which seem to match what I am seeing.
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I attach an image below of the results I am getting with the intersection between the lines and the polygon on my Windows machine. Red lines are the lines which were not considered part of the intersection and the thicker green lines are what was identified
 as the intersection between the grid of line segments and the polygon. It seems all lines that intersect the polygon boundary are correctly identified but only some lines that are entirely within the polygon boundary are included in the intersection.
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<img style="max-width: 100%;" size="67355"><br>
</div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I had initially reported this as an issue in sf and there are more examples there:
<a id="gmail-m_7469303234201356325LPlnk948060">https://github.com/r-spatial/sf/issues/1781</a><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="gmail-m_7469303234201356325Signature">
<div>
<div id="gmail-m_7469303234201356325divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<p style="margin-top:0px;margin-bottom:0px">
Question 1: Is this a known issue with 3.9.0?</p>
<p style="margin-top:0px;margin-bottom:0px">
<br>
</p>
<p style="margin-top:0px;margin-bottom:0px">
Question 2: Is there an easy way to directly install 3.9.1 on to a Windows machine to test the behaviour with the latest version?
<br>
</p>
<p style="margin-top:0px;margin-bottom:0px">
<br>
</p>
<p style="margin-top:0px;margin-bottom:0px">
Many thanks for your help,</p>
<p style="margin-top:0px;margin-bottom:0px">
<br>
</p>
<p style="margin-top:0px;margin-bottom:0px">
Laura<br>
</p>
<p style="margin-top:0px;margin-bottom:0px">
<br>
</p>
<p style="margin-top:0px;margin-bottom:0px">
Dr. L Marshall</p>
<p style="margin-top:0px;margin-bottom:0px">
Centre for Research into Ecological & Environmental Modelling</p>
<p style="margin-top:0px;margin-bottom:0px">
University of St. Andrews</p>
<p style="margin-top:0px;margin-bottom:0px">
<br>
</p>
<p style="margin-top:0px;margin-bottom:0px">
<br>
</p>
</div>
</div>
</div>
</div>
</div>

_______________________________________________<br>
geos-devel mailing list<br>
<a>geos-devel@lists.osgeo.org</a><br>
<a rel="noreferrer">https://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
</blockquote></div>