Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/explode

Package Overview
Dependencies
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/explode

turf explode module

  • 3.5.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
763K
increased by10.69%
Maintainers
2
Weekly downloads
 
Created

What is @turf/explode?

@turf/explode is a module from the Turf.js library that is used to convert a GeoJSON object into a collection of points. This can be useful for various geospatial analyses where you need to work with individual points extracted from more complex geometries like polygons or lines.

What are @turf/explode's main functionalities?

Convert Polygon to Points

This feature allows you to convert a polygon into a collection of points. Each vertex of the polygon becomes an individual point in the resulting GeoJSON FeatureCollection.

const turf = require('@turf/turf');
const polygon = turf.polygon([[
  [-81, 41],
  [-81, 47],
  [-72, 47],
  [-72, 41],
  [-81, 41]
]]);
const exploded = turf.explode(polygon);
console.log(exploded);

Convert LineString to Points

This feature allows you to convert a LineString into a collection of points. Each vertex of the LineString becomes an individual point in the resulting GeoJSON FeatureCollection.

const turf = require('@turf/turf');
const line = turf.lineString([
  [-81, 41],
  [-81, 47],
  [-72, 47],
  [-72, 41]
]);
const exploded = turf.explode(line);
console.log(exploded);

Convert MultiPolygon to Points

This feature allows you to convert a MultiPolygon into a collection of points. Each vertex of each polygon in the MultiPolygon becomes an individual point in the resulting GeoJSON FeatureCollection.

const turf = require('@turf/turf');
const multiPolygon = turf.multiPolygon([[
  [[-81, 41], [-81, 47], [-72, 47], [-72, 41], [-81, 41]]
], [
  [[-91, 31], [-91, 37], [-82, 37], [-82, 31], [-91, 31]]
]]);
const exploded = turf.explode(multiPolygon);
console.log(exploded);

Other packages similar to @turf/explode

Keywords

FAQs

Package last updated on 22 Aug 2016

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