Closed rgwozdz closed 2 years ago
thanks for the thorough simplified repro-case.
Not sure if this is intentional or just something that was missed. Can you advise?
definitely sounds like the latter to me.
my guess is that the problem is within (groan!) the following clause.
// https://github.com/terraformer-js/terraformer/blob/0d8379a9ca5dc1fafd4c272b242144fcb3d53a04/packages/spatial/src/intersects.js#L14-L16
if (within(geoJSON, comparisonGeoJSON) || within(comparisonGeoJSON, geoJSON)) {
return true;
}
if we tested whether any of the MultiPolygon's child coordinate arrays were within()
the filter here, we'd return the correct result.
a PR would be welcome (as always)
Thanks @jgravois! I'll try to get to this soon, though I'm about to be away from computers for two weeks.
released in v2.1.2
🎉
thanks for tee-ing up the fix and for your patience @rgwozdz. i just sent you an invite to npm@terraformer and wrote up a few breadcrumbs for next time.
https://github.com/terraformer-js/terraformer/commit/d3ae7d8cd9f3b60f548446a39ad8f72347505207 / https://github.com/terraformer-js/terraformer/blob/main/CONTRIBUTING.md#publishing-a-release
Hey again. I start with a multipolygon geometry (green) and a simple polygon (hash-fill). They look like this:
When I do an
intersects
for these two geometries, I'm expecting a result oftrue
. On an ArcGIS service, I do find that an intersect filter operation like this (with multipolygon as data set and simple polygon as filter) returns a result. Similarly in QGIS, a select operation on the multipolygon using an intersection of the simple polygon results in the multipolygon being selected.But I find the terraformer
intersects
returnsfalse
:So in the above example, terraformer result seems to diverge from similar operation in QGIS/ArcGIS. Not sure if this is intentional or just something that was missed. Can you advise?
Interestingly, if I adjust the filter polygon so that its boundary crosses one of the multipolygon's component polygons, the result is
true
.