Turf: Boolean Overlap - doesn't overlap inside polygon

Created on 22 Oct 2017  路  8Comments  路  Source: Turfjs/turf

@turf/boolean-overlap - doesn't overlap inside polygon

@rowanwins I've been using @turf/boolean-overlap to apply a mask operation on the grid modules. Each grid polygon does the boolean-overlap method and should return false/true, however it seems like the polygon that are completely within (not touching the lines) are not counted as overlapping, is that the expected behavior? I would assume that the inner polys should still be overlapping the mask polygon.

@stebogit Thoughts? Since we're working on the grid modules.

@turf/triangle-grid

image

@turf/square-grid

image

question

All 8 comments

@DenisCarriere from the docs @turf-overlaps

Compares two geometries of the same dimension and returns true if their intersection set results in _a geometry different from both_ but of the same dimension. It applies to Polygon/Polygon, LineString/LineString, Multipoint/Multipoint, MultiLineString/MultiLineString and MultiPolygon/MultiPolygon.

The intersection of the big polygon with the inner grid polygons is actually equal to the grid polygon, so they do not technically overlap (based on the definition).
I think here @turf/boolean-contains or @turf/boolean-within would be the appropriate one to use.

Hi @DenisCarriere

This definition from the FME docs is also helpful here

The interiors intersect, but neither feature is contained by the other, nor are the features equal.

So I think @stebogit is on the money with his recommendation, it might be worth a quick check to see if one or the other is more performant that than the other for this use case...

馃憤 Thanks for the answers, the FME docs are pretty good at explaining it, i'll use @turf/boolean-contains for what I'm trying to do.

The interiors intersect, but neither feature is contained by the other, nor are the features equal.

I actually combined both contains + overlap to get the final result:

image

Only using contains gave me this:

image

I think contains + overlap is more similar to what you would expect out of this module. Good job! 馃憤

@DenisCarriere boolean-intersect is probably what is required to get the proper result

@rowanwins Agreed, however it's not implemented yet (the boolean-intersect) 馃槃

I'm using @turf/intersect and it works out pretty good for this scenario.

image

Was this page helpful?
0 / 5 - 0 ratings