JSPM

  • Created
  • Published
  • Downloads 749044
  • Score
    100M100P100Q193205F
  • License MIT

turf dissolve module

Package Exports

  • @turf/dissolve

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@turf/dissolve) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@turf/dissolve

dissolve

Dissolves a FeatureCollection of polygons based on a property. Note that multipart features within the collection are not supported

Parameters

  • featureCollection FeatureCollection<Polygon> input feature collection to be dissolved
  • propertyName [string] property name on which to dissolve features

Examples

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');

//addToMap
var addToMap = [features, dissolved]

Returns FeatureCollection<Polygon> a FeatureCollection containing the dissolved polygons


This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.

Installation

Install this module individually:

$ npm install @turf/dissolve

Or install the Turf module that includes it as a function:

$ npm install @turf/turf