How to use @turf/simplify - 4 common examples

To help you get started, we’ve selected a few @turf/simplify 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 bemky / mapbox-gl-draw-freehand-mode / src / index.js View on Github external
FreeDraw.onMouseUp = function (state, e){
    if (state.dragMoving) {
        var tolerance = (3 / ((this.map.getZoom()-4) * 150)) - 0.001 // https://www.desmos.com/calculator/b3zi8jqskw
        simplify(state.polygon, {
            mutate: true,
            tolerance: tolerance,
            highQuality: true
        });
            
        this.fireUpdate();
        this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.polygon.id] });
    }
}
github tmcw / geojson.net / src / ui / file_bar.js View on Github external
action: () => {
              const { setGeojson, geojson } = this.props;
              setGeojson(simplify(geojson));
            }
          },
github FreemapSlovakia / freemap-v3-react / src / reducers / globalReducer.ts View on Github external
return;
      }

      const points: Point[] = [];

      const coords: number[][] = [];

      for (const itItem of alt.itinerary) {
        for (const point of itItem.shapePoints) {
          coords.push(point);
        }
      }

      let id = 0;

      for (const p of simplify(lineString(coords), {
        mutate: true,
        tolerance: 0.0005,
      }).geometry.coordinates) {
        points.push({
          lat: p[0],
          lon: p[1],
          id,
        });

        id++;
      }

      draft.distanceMeasurement.lines.push({
        type: 'distance',
        points,
      });
github mapbox / osmcha-frontend / src / components / filters / location.js View on Github external
onChangeLocal = (data: ?Array) => {
    if (data) {
      this.draw.deleteAll();
      const simplified_bounds = simplify(data.value, { tolerance: 0.1 });
      this.updateMap(simplified_bounds);
    }
  };
  handleQueryTypeChange = value => {

@turf/simplify

turf simplify module

MIT
Latest version published 1 month ago

Package Health Score

96 / 100
Full package analysis

Popular @turf/simplify functions