Socket
Book a DemoInstallSign in
Socket

@turf/simplify

Package Overview
Dependencies
Maintainers
9
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/simplify

turf simplify module

7.2.0
latest
Source
npmnpm
Version published
Weekly downloads
635K
-23.1%
Maintainers
9
Weekly downloads
 
Created

What is @turf/simplify?

@turf/simplify is a module within the Turf.js library that provides functionality to simplify GeoJSON geometries. It uses the Ramer-Douglas-Peucker algorithm to reduce the number of points in a geometry while retaining its overall shape. This can be useful for reducing the complexity of geometries for faster processing and rendering.

What are @turf/simplify's main functionalities?

Simplify a LineString

This feature allows you to simplify a LineString geometry. The `tolerance` parameter controls the level of simplification, and `highQuality` determines whether to use a slower, higher-quality algorithm.

const turf = require('@turf/turf');
const line = turf.lineString([[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]);
const simplified = turf.simplify(line, {tolerance: 0.01, highQuality: false});
console.log(simplified);

Simplify a Polygon

This feature allows you to simplify a Polygon geometry. Similar to the LineString example, you can control the simplification level with the `tolerance` parameter and choose between a faster or higher-quality algorithm with `highQuality`.

const turf = require('@turf/turf');
const polygon = turf.polygon([[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [0, 0]]]);
const simplified = turf.simplify(polygon, {tolerance: 0.01, highQuality: false});
console.log(simplified);

Other packages similar to @turf/simplify

Keywords

turf

FAQs

Package last updated on 29 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.