Turf.jsTransformation

turf.dissolve

What is turf.dissolve?

turf.dissolve takes a FeatureCollection<Polygon> and merges polygons that share edges into one. If you pass a propertyName, only polygons with equal values of that property are merged — a common "dissolve by attribute" workflow.

JavaScript
turf.dissolve(featureCollection, options?) → FeatureCollection<Polygon>

Options include:

  • propertyName — only dissolve polygons sharing this property value

When would you use turf.dissolve?

Use turf.dissolve to collapse a grid of tiled polygons into contiguous regions — for example, merging census tracts into districts, simplifying a parcel grid into land-use zones, or combining touching geofences into one. It replaces hand-coded PostGIS ST_Union flows when you need the operation client-side or in a static-site build.

Pair with turf.union when the inputs are not strictly polygon-only, or with turf.simplify afterwards to reduce vertex count on the merged result.

Code
undefined

FAQs

Do polygons need to share edges exactly?

Yes — turf.dissolve requires shared vertices/edges. If your polygons have micro-gaps or slightly misaligned boundaries, preprocess with turf.cleanCoords and a snapping step, or use turf.union which is more permissive.

What happens if polygons overlap?

turf.dissolve is designed for tiled, non-overlapping inputs. Overlapping polygons produce unpredictable results — use turf.union for arbitrary merging.

How do I install just dissolve?

npm install @turf/dissolve. It depends on @turf/helpers, @turf/meta, @turf/clone, and polygon-clipping.

Does it preserve properties?

When propertyName is provided, the merged polygon inherits the shared value under that key. Other properties are not automatically carried across — add a post-processing step to re-attach attributes if needed.