How to use @turf/flatten - 2 common examples

To help you get started, we’ve selected a few @turf/flatten 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
.reduce((memo, feature) => {
      if (feature.geometry.type === "MultiPolygon") {
        // Flatten any MultiPolygons to arrays of individual Polygon features,
        // because `booleanOverlap` can only compare like feature types.
        try {
          feature = flatten(feature).features;
        } catch (e) {
          // eslint-disable-next-line no-console
          console.error(e);
          Mixpanel.track("Error", {
            message: "unable to perform flatten on features",
            error: e,
          });

          feature = [];
        }
      }

      return memo.concat(feature);
    }, [])
    .filter(feature => {
github FreemapSlovakia / freemap-v3-react / src / components / TrackViewerResult.tsx View on Github external
getFeatures: GetFeatures = (type: 'LineString' | 'Point') =>
    turfFlatten(this.props.trackGeojson as any).features.filter(
      f => f && f.geometry && f.geometry.type === type,
    ) as any;

@turf/flatten

turf flatten module

MIT
Latest version published 3 months ago

Package Health Score

96 / 100
Full package analysis

Popular @turf/flatten functions