{"name":"polygonize","version":"1.1.0","description":"Javascript implementation of GEOS's Polygonize function","main":"cjs/index.js","module":"src/index.js","scripts":{"test":"npm run lint && npm run test-src && npm run bench","test-cjs":"npm run build-cjs && tape cjs/*.test.js cjs/test.js","test-src":"tape -r @std/esm src/*.test.js src/test.js","lint":"eslint .","prebuild":"rimraf cjs","build-cjs":"babel src --out-dir cjs","build":"npm run build-cjs","prepublishOnly":"npm run build","bench-src":"node -r @std/esm src/bench.js","bench-cjs":"node cjs/bench.js","bench":"npm run bench-src"},"repository":{"type":"git","url":"git://github.com/nickcis/polygonize.git"},"keywords":["geojson","gis","polygonize","polygon","line","linestring"],"author":{"name":"Nicolas Cisco","email":"@nickcis"},"license":"MIT","bugs":{"url":"https://github.com/nickcis/polygonize/issues"},"homepage":"https://github.com/nickcis/polygonize#readme","devDependencies":{"@std/esm":"^0.11.3","babel-cli":"^6.26.0","babel-plugin-add-module-exports":"^0.2.1","babel-preset-env":"^1.6.1","benchmark":"^2.1.4","eslint":"^3.19.0","eslint-config-mourner":"^2.0.1","load-json-file":"^2.0.0","rimraf":"^2.6.2","tape":"^4.6.3","write-json-file":"^2.2.0"},"dependencies":{"@turf/envelope":"*","@turf/helpers":"*","@turf/inside":"*","@turf/invariant":"*","@turf/meta":"*"},"@std/esm":{"esm":"js","cjs":true},"gitHead":"810b0f26464f1fef5af06e236633ca82d1be8b34","_id":"polygonize@1.1.0","_shasum":"a342e18f57351307c6c46f8c58997664333cc2da","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"nickcis","email":"ncis20@gmail.com"},"dist":{"shasum":"a342e18f57351307c6c46f8c58997664333cc2da","tarball":"http://registry-npm.ywwl.com/polygonize/download/polygonize-1.1.0.tgz","integrity":"sha512-ArjPKg+acqgNPY6dR7ToF0cL88pc9+j5ljYVZ+E7mJzs9+vhHGpVGb2dI9eDvi/zAM55RADiEJy35WnUwxqd2Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC2dRUkSvULRRd6sPiZzDyKTNmtWVh4dGFZHwB1nSGI+AIgGkFO3mQPb3+AkyZkXqxhINAz+1rilhNv2xheQHrJYOw="}],"size":67979,"noattachment":false,"key":"/polygonize/-/polygonize-1.1.0.tgz"},"maintainers":[{"name":"nickcis","email":"ncis20@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polygonize-1.1.0.tgz_1508333508268_0.42909898748621345"},"directories":{},"readme":"# Polygonize\n\n[![Build Status](https://travis-ci.org/NickCis/polygonize.svg?branch=master)](https://travis-ci.org/NickCis/polygonize)\n\nPolygonizes a set of Geometrys which contain linework that represents the edges of a planar graph. It's basically an implementation of [GEOS's Polygonizer](https://github.com/echoz/xlibspatialite/blob/master/geos/include/geos/operation/polygonize/Polygonizer.h).\n\nAlthough, the algorithm is the same as GEOS, it isn't a literal transcription of the C++ source code. It was rewriten in order to get a more javascript like code.\n\n## JSDoc\n\n```javascript\n/**\n * Polygonizes {@link LineString|(Multi)LineString(s)} into {@link Polygons}.\n *\n * Implementation of GEOSPolygonize function (`geos::operation::polygonize::Polygonizer`).\n *\n * Polygonizes a set of lines that represents edges in a planar graph. Edges must be correctly\n * noded, i.e., they must only meet at their endpoints.\n *\n * The implementation correctly handles:\n *\n * - Dangles: edges which have one or both ends which are not incident on another edge endpoint.\n * - Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.\n *\n * @name polygonize\n * @param {FeatureCollection|Geometry|Feature<LineString|MultiLineString>} geoJson Lines in order to polygonize\n * @returns {FeatureCollection<Polygon>} Polygons created\n * @throws {Error} if geoJson is invalid.\n */\n```\n\n## Example\n\nThis example is the test found in [`test/in/complex.geojson`](https://github.com/NickCis/polygonize/blob/master/test/in/complex.geojson).\n\n\n```javascript\nconst polygonize = require('polygonize'),\n    fs = require('fs'),\n    input = JSON.parse(fs.readFileSync('./test/in/complex.geojson'));\n\nconsole.log(JSON.stringify(polygonize(input)));\n```\n\nThe [input](https://github.com/NickCis/polygonize/blob/master/test/in/complex.geojson) as GeoJson LineString:\n\n![](https://cloud.githubusercontent.com/assets/174561/26525683/c30957de-4335-11e7-8eb9-bf72f268efb8.png)\n\nTurned into [polygons](https://github.com/NickCis/polygonize/blob/master/test/out/complex.geojson):\n\n![](https://cloud.githubusercontent.com/assets/174561/26525695/24f5270c-4336-11e7-9b62-60db8c0c9a28.png)\n\n\n## Documentation\n\nPolygonizes [(Multi)LineString(s)](http://geojson.org/geojson-spec.html#linestring) into [Polygons](Polygons).\n\nImplementation of GEOSPolygonize function (`geos::operation::polygonize::Polygonizer`).\n\nPolygonizes 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.\n\nThe implementation correctly handles:\n\n-   Dangles: edges which have one or both ends which are not incident on another edge endpoint.\n-   Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.\n\n**Parameters**\n\n-   `geojson` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \\| [Geometry](http://geojson.org/geojson-spec.html#geometry) \\| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;([LineString](http://geojson.org/geojson-spec.html#linestring) \\| [MultiLineString](http://geojson.org/geojson-spec.html#multilinestring))>)** Lines in order to polygonize\n\n\n-   Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if geoJson is invalid.\n\nReturns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Polygon](http://geojson.org/geojson-spec.html#polygon)>** Polygons created\n\n### Installation\n\nInstall this module individually:\n\n```sh\n$ npm install polygonize\n```\n","publish_time":1508333508546,"_cnpm_publish_time":1508333508546,"dist-tags":{"latest":"1.0.4"}}