@turf/dissolve
Advanced tools
Comparing version 3.7.5 to 3.8.0
{ | ||
"name": "@turf/dissolve", | ||
"version": "3.7.5", | ||
"version": "3.8.0", | ||
"description": "Dissolves polygons based on an attribute", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,7 +0,81 @@ | ||
# turf-dissolve | ||
Dissolves a featurecollection of polygons based on an attribute | ||
# @turf/dissolve | ||
```` | ||
var aggregated = turfDissolve(polys, 'combine'); | ||
# dissolve | ||
```` | ||
Dissolves a FeatureCollection of polygons based on a property. Note that multipart features within the collection are not supported | ||
**Parameters** | ||
- `featureCollection` **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)<[Polygon](http://geojson.org/geojson-spec.html#polygon)>** input feature collection to be dissolved | ||
- `propertyName` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** property name on which to dissolve features | ||
**Examples** | ||
```javascript | ||
var features = { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"combine": "yes" | ||
}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"combine": "yes" | ||
}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [[[0, -1], [0, 0], [1, 0], [1, -1], [0,-1]]] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"combine": "no" | ||
}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [[[1,-1],[1, 0], [2, 0], [2, -1], [1, -1]]] | ||
} | ||
} | ||
] | ||
} | ||
var dissolved = turf.dissolve(features, 'combine'); | ||
//=dissolved | ||
``` | ||
Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)<[Polygon](http://geojson.org/geojson-spec.html#polygon)>** a FeatureCollection containing the dissolved polygons | ||
<!-- This file is automatically generated. Please don't edit it directly: | ||
if you find an error, edit the source file (likely index.js), and re-run | ||
./scripts/generate-readmes in the turf project. --> | ||
--- | ||
This module is part of the [Turfjs project](http://turfjs.org/), an open source | ||
module collection dedicated to geographic algorithms. It is maintained in the | ||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create | ||
PRs and issues. | ||
### Installation | ||
Install this module individually: | ||
```sh | ||
$ npm install @turf/dissolve | ||
``` | ||
Or install the Turf module that includes it as a function: | ||
```sh | ||
$ npm install @turf/turf | ||
``` |
@@ -19,3 +19,3 @@ var fs = require('fs'); | ||
var dissolved = dissolve(polys, 'combine'); | ||
save(dissolve, 'polysByProperty.json') | ||
save(dissolved, 'polysByProperty.json') | ||
t.equal(dissolved.features.length, 3); | ||
@@ -22,0 +22,0 @@ t.deepEqual(dissolved, require(pathOut + 'polysByProperty.json')); |
10893
82