Socket
Socket
Sign inDemoInstall

@turf/simplify

Package Overview
Dependencies
Maintainers
9
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/simplify

turf simplify module


Version published
Weekly downloads
695K
decreased by-13.39%
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

FAQs

Package last updated on 09 Aug 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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc