<div dir="ltr"><div>Hi all,</div><div><br></div><div>On the CI of PyGEOS we have a build testing against GEOS master, and somewhere in the last 4 days, a lot of the STRtree tests started failing (see eg <a href="https://github.com/pygeos/pygeos/runs/1465460418#step:9:86">https://github.com/pygeos/pygeos/runs/1465460418#step:9:86</a>). Looking at the commits of the last days, this might be related to the SimpleSTRtree work?</div><div><br></div><div>A small (python) example of a tree consisting of a single point, which no longer is returned when querying the tree with a big polygon that certainly contains the point:</div><div><br></div><div>Using released version of GEOS:</div><div><br></div><div><span style="font-family:monospace">>>> import pygeos</span></div><div><span style="font-family:monospace">>>> pygeos.geos_version</span></div><div><span style="font-family:monospace">(3, 8, 1)</span></div><div><span style="font-family:monospace">>>> point = pygeos.Geometry("POINT (2 3)") <br></span></div><div><span style="font-family:monospace">>>> tree = pygeos.STRtree([point]) <br></span></div><div><span style="font-family:monospace">>>> tree.query(pygeos.box(0, 0, 10, 10)) <br></span></div><div><span style="font-family:monospace">array([0])</span><br></div><div><br></div><div>This is correctly returning the index of the single point. But when running with the latest GEOS master, the query doesn't find any point of the tree:<br></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">>>> import pygeos<br></span></div><div><span style="font-family:monospace">>>> pygeos.geos_version</span></div><div><span style="font-family:monospace">(3, 9, 0)<br>>>> point = pygeos.Geometry("POINT (2 3)")</span></div><div><span style="font-family:monospace">>>> tree = pygeos.STRtree([point])</span></div><div><span style="font-family:monospace">>>> tree.query(pygeos.box(0, 0, 10, 10))</span></div><div><span style="font-family:monospace">array([], dtype=int64)</span><br></div><div><br></div><div>Are there changes expected in how the STRtree C API functions or required changes in user code? Or maybe we are using it in some incorrect/unexpected way? (code is at <a href="https://github.com/pygeos/pygeos/blob/master/src/strtree.c">https://github.com/pygeos/pygeos/blob/master/src/strtree.c</a>)</div><div><br></div><div>Best,</div><div>Joris<br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 25 Nov 2020 at 00:44, Paul Ramsey <<a href="mailto:pramsey@cleverelephant.ca">pramsey@cleverelephant.ca</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">Hey all, just truing up what's underway and nearly there...<br>
<br>
- Am I right that Z coordinates are nearly done? What's the status there?<br>
<br>
I've been trying to address some performance issues, with some success and some ... other things. <br>
<br>
The success is the SimpleSTRtree, which is just the current STRtree but without the inheritance structure and with the nodes stored all next to each other in contiguous memory for more locality. For at least one use case I've seen 20% speed-ups on overlays, using the SimpleSTRtree in place of the STRtree inside the MCIndexNoder. I have not seen any slow-downs. I have pushed the SimpleSTRtree into master.<br>
<br>
While I have implemented the nearestNeighbor() functionality on the SimpleSTRtree, I haven't hooked it up to anything yet. It could go into the IndexedFacetDistance, if anyone is super enthusiastic about it. From there it would affect searching in PreparedGeometry of various sorts.<br>
<br>
I also tried using a similar trick with the MonotoneChainBuilder that sits inside the MCIndexNoder, replacing individual heap allocations with slabs by putting objects onto a std::deque, and incidentally stripping out some book-keeping. While that seems to pick up about 3-5% speedwise, unfortunately something about my implementation is incorrect (and in a wonderfully subtle way) as it fails testing on some platforms (not mine). <a href="https://github.com/pramsey/geos/tree/monotone-chain-builder" rel="noreferrer" target="_blank">https://github.com/pramsey/geos/tree/monotone-chain-builder</a><br>
<br>
I've put that work to the side for now.<br>
<br>
All the performance talk is mostly because JTS still runs a lot faster than GEOS for some bulk processing. My current test is a big union of watershed boundaries, about 6MB of data, which takes about 20s under GEOS and about 25% of that under JTS.  It's a big gap, and in theory the two code bases are pretty aligned right now. Same overlayNG engine, etc. So I figure there has to be a big implementation ball of performance hiding under the covers somewhere. No luck thus far.<br>
<br>
I think we're close, looking forward to release :)<br>
<br>
P<br>
_______________________________________________<br>
geos-devel mailing list<br>
<a href="mailto:geos-devel@lists.osgeo.org" target="_blank">geos-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/geos-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
</blockquote></div></div>