@turf/polygonize
Advanced tools
Comparing version 4.7.3 to 5.0.4
@@ -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>; |
90
index.js
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7783
6
104
54
8
+ Added@turf/bbox@7.1.0(transitive)
+ Added@turf/bbox-polygon@7.1.0(transitive)
+ Added@turf/envelope@7.1.0(transitive)
+ Added@turf/helpers@5.1.57.1.0(transitive)
+ Added@turf/inside@5.0.0(transitive)
+ Added@turf/invariant@5.2.07.1.0(transitive)
+ Added@turf/meta@7.1.0(transitive)
+ Added@types/geojson@7946.0.15(transitive)
+ Addedpolygonize@1.1.0(transitive)
+ Addedtslib@2.8.1(transitive)
- Removed@turf/bbox@4.7.3(transitive)
- Removed@turf/bbox-polygon@4.7.3(transitive)
- Removed@turf/envelope@4.7.3(transitive)
- Removed@turf/helpers@4.7.3(transitive)
- Removed@turf/inside@4.7.3(transitive)
- Removed@turf/invariant@4.7.3(transitive)
- Removed@turf/meta@4.7.4(transitive)
- Removedpolygonize@1.0.1(transitive)
Updatedpolygonize@^1.1.0