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

@turf/polygonize

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/polygonize - npm Package Compare versions

Comparing version 4.7.3 to 5.0.4

main.js

11

index.d.ts

@@ -1,11 +0,8 @@

/// <reference types="geojson" />
import { Feature, FeatureCollection, Coord, Polygon, LineString, MultiLineString } from '@turf/helpers'
type Polygons = GeoJSON.FeatureCollection<GeoJSON.Polygon>;
type Geoms = GeoJSON.LineString | GeoJSON.MultiLineString;
/**
* http://turfjs.org/docs/#polygonize
*/
declare function polygonize<Geom extends Geoms>(geojson: GeoJSON.Feature<Geom> | GeoJSON.FeatureCollection<Geom> | Geom): Polygons;
declare namespace polygonize { }
export = polygonize;
export default function <T extends LineString | MultiLineString>(
geojson: Feature<T> | FeatureCollection<T> | T
): FeatureCollection<Polygon>;

@@ -1,15 +0,10 @@

var polygonize = require('polygonize');
import polygonize from 'polygonize';
/**
* Polygonizes {@link LineString|(Multi)LineString(s)} into {@link Polygons}.
*
* Implementation of GEOSPolygonize function (`geos::operation::polygonize::Polygonizer`).
*
* Polygonizes {@link LineString|(Multi)LineString(s)} into {@link Polygons}. Implementation of GEOSPolygonize function (`geos::operation::polygonize::Polygonizer`).
* Polygonizes a set of lines that represents edges in a planar graph. Edges must be correctly
* noded, i.e., they must only meet at their endpoints. (NOTE: while TurfJS has no specific function, an easy way to
* ensure this is to use the QGis library and call unaryUnion() on the set of input geometries and then pass the
* result to turf-polygonize)
*
* result to turf-polygonize).
* The implementation correctly handles:
*
* - Dangles: edges which have one or both ends which are not incident on another edge endpoint.

@@ -22,5 +17,78 @@ * - Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.

* @throws {Error} if GeoJSON is invalid.
* @example
* var lines = {
* "type": "FeatureCollection",
* "features": [
* {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "LineString",
* "coordinates": [
* [
* 119.00390625,
* -22.024545601240337
* ],
* [
* 120.58593749999999,
* -28.613459424004414
* ],
* [
* 125.595703125,
* -32.99023555965107
* ],
* [
* 133.330078125,
* -32.99023555965107
* ],
* [
* 142.646484375,
* -30.977609093348676
* ],
* [
* 142.294921875,
* -24.126701958681668
* ],
* [
* 139.04296875,
* -16.299051014581817
* ],
* [
* 128.84765625,
* -15.199386048559994
* ]
* ]
* }
* },
* {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "LineString",
* "coordinates": [
* [
* 142.646484375,
* -30.977609093348676
* ],
* [
* 132.451171875,
* -27.449790329784214
* ],
* [
* 128.671875,
* -23.1605633090483
* ],
* [
* 119.00390625,
* -22.024545601240337
* ]
* ]
* }
* }
* ]
* }
* var outPolygon = turf.polygonize(lines)
* //addToMap
* var addToMap = [lines, outPolygon];
*/
module.exports = function (geojson) {
return polygonize(geojson);
};
export default polygonize;
{
"name": "@turf/polygonize",
"version": "4.7.3",
"version": "5.0.4",
"description": "turf polygonize module",
"main": "index.js",
"main": "main",
"module": "index",
"jsnext:main": "index",
"types": "index.d.ts",
"files": [
"index.js",
"index.d.ts"
"index.d.ts",
"main.js"
],
"scripts": {
"test": "node test.js",
"bench": "node bench.js"
"pretest": "rollup -c ../../rollup.config.js",
"test": "node -r @std/esm test.js",
"bench": "node -r @std/esm bench.js"
},

@@ -36,12 +40,18 @@ "repository": {

"devDependencies": {
"@turf/helpers": "^4.7.3",
"@turf/meta": "^4.7.3",
"benchmark": "2.1.4",
"load-json-file": "2.0.0",
"tape": "4.7.0",
"write-json-file": "2.2.0"
"@std/esm": "*",
"@turf/helpers": "^5.0.4",
"@turf/meta": "^5.0.4",
"benchmark": "*",
"load-json-file": "*",
"rollup": "*",
"tape": "*",
"write-json-file": "*"
},
"dependencies": {
"polygonize": "1.0.1"
"polygonize": "^1.1.0"
},
"@std/esm": {
"esm": "js",
"cjs": true
}
}
# @turf/polygonize
# polygonize
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## polygonize
Polygonizes [(Multi)LineString(s)](http://geojson.org/geojson-spec.html#linestring) into [Polygons](Polygons).

@@ -6,0 +8,0 @@

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