How to use @turf/boolean-overlap - 4 common examples

To help you get started, we’ve selected a few @turf/boolean-overlap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mapseed / platform / src / base / static / utils / geo.js View on Github external
.filter(feature => {
      try {
        return (
          // Technically, we're doing more than an overlap comparison here.
          // `boooleanOverlap` returns features which are strictly overlapping; we
          // also want to return features which are entirely contained by the
          // buffer.
          booleanOverlap(bufferFeature, feature) ||
          booleanContains(bufferFeature, feature)
        );
      } catch (e) {
        // eslint-disable-next-line no-console
        console.error(e);
        Mixpanel.track("Error", {
          message:
            "unable to perform booleanOverlap and booleanContains on features",
          error: e,
        });

        return false;
      }
    })
    .reduce(
github Turfjs / turf / packages / turf-dissolve / index.js View on Github external
var closestNumber = closestGreaterNumber(matchFeaturePosition, originalIndexOfItemsRemoved);
                    if (closestNumber !== 0) {
                        matchFeaturePosition = matchFeaturePosition - closestNumber;
                    }
                }
            }

            if (matchFeaturePosition === +i) return;

            var matchFeature = features[matchFeaturePosition];
            if (!matchFeature || !polygon) return;

            if (propertyName !== undefined &&
                matchFeature.properties[propertyName] !== polygon.properties[propertyName]) return;

            if (!overlap(polygon, matchFeature) || !ringsIntersect(polygon, matchFeature)) return;

            features[i] = turfUnion(polygon, matchFeature);

            originalIndexOfItemsRemoved.push(potentialMatchingFeature.properties.origIndexPosition);
            originalIndexOfItemsRemoved.sort(function (a, b) {
                return a - b;
            });

            tree.remove(potentialMatchingFeature);
            features.splice(matchFeaturePosition, 1);
            polygon.properties.origIndexPosition = i;
            tree.remove(polygon, function (a, b) {
                return a.properties.origIndexPosition === b.properties.origIndexPosition;
            });
            featureChanged = true;
        });
github geosolutions-it / MapStore2 / web / client / utils / CoordinatesUtils.js View on Github external
    isBboxCompatible: (extent1, extent2) => overlap(extent1, extent2) || contains(extent1, extent2) || contains(extent2, extent1)

@turf/boolean-overlap

turf boolean-overlap module

MIT
Latest version published 3 years ago

Package Health Score

78 / 100
Full package analysis

Popular @turf/boolean-overlap functions