Gis, Qgis, ArcGis  Experts Just a Click Away

How to Dissolve Polygons with ArcPy in Python

ArcPy’s Dissolve tool combines polygon features that share one or more attribute values. It removes internal boundaries within each group and creates a new feature class with fewer, larger features. You can use it to aggregate parcels by owner, census blocks by district, land-cover polygons by class, or administrative areas by region.

In ArcGIS Pro, the tool is available through arcpy.management.Dissolve( ). This guide explains the syntax, shows complete Python examples, and covers the decisions that most often affect the result: dissolve fields, statistics, multipart output, null values, geometry problems, large features, and validation.

Important: Dissolve changes geometry and creates a new output feature class. It does not simply edit the original polygons in place.

Quick example: dissolve polygons by an attribute

The following script combines polygons with the same REGION_ID value and writes the result to a file geodatabase.

import arcpy

input_features = r"C:\GIS_Data\Project\input.gdb\districts"
output_features = r"C:\GIS_Data\Project\output.gdb\regions_dissolved"

dissolve_fields = ["REGION_ID"]

arcpy.env.overwriteOutput = True

arcpy.management.Dissolve(
    in_features=input_features,
    out_feature_class=output_features,
    dissolve_field=dissolve_fields,
    multi_part="MULTI_PART"
)

print(f"Created: {output_features}")

The output contains one feature for each unique REGION_ID value, subject to the geometry and multipart settings. If you omit dissolve_field, all input features are dissolved together into one output feature or multipart feature.

What does dissolving polygons mean?

Dissolving is an aggregation operation. The tool groups input features according to the values in the selected dissolve fields and removes the boundaries between features in the same group. Attributes that are not dissolve fields are not automatically preserved as meaningful one-to-one values. If you need to retain numeric or text information, specify it through the statistics fields parameter.

For example, suppose a parcel layer contains ten polygons and the field OWNER_TYPE contains PUBLIC or PRIVATE. Dissolving on OWNER_TYPE creates an output group for each value. The internal parcel lines within each group disappear, while the boundary between public and private land remains.

Dissolve is useful for:

  • aggregating census blocks into neighborhoods;
  • combining parcels by ownership or zoning class;
  • creating regional boundaries from smaller administrative units;
  • simplifying land-cover or habitat polygons;
  • preparing boundaries for map display; and
  • summarizing numeric attributes while changing the geometry.

Dissolve is different from Merge. Merge places datasets or features together without removing internal boundaries. Dissolve aggregates features according to fields and removes boundaries within each group.

ArcPy Dissolve syntax

The ArcGIS Pro function uses this general form:

arcpy.management.Dissolve(
    in_features,
    out_feature_class,
    dissolve_field=None,
    statistics_fields=None,
    multi_part="MULTI_PART",
    unsplit_lines="DISSOLVE_LINES",
    concatenation_separator=""
)

For polygon workflows, the most important parameters are:

  • in_features: the input feature layer or feature class;
  • out_feature_class: the new output feature class;
  • dissolve_field: one field or a list of fields that defines groups;
  • statistics_fields: optional field/statistic pairs;
  • multi_part: whether separate parts can be stored in one output feature;
  • unsplit_lines: mainly relevant to line input, not polygons; and
  • concatenation_separator: used when a CONCATENATION statistic is selected.

Using keyword arguments makes a script easier to read and helps prevent mistakes when optional parameters are added or changed.

Dissolve all polygons into one output

To dissolve every input polygon together, leave the dissolve-field parameter empty. In Python, use None or omit the argument.

import arcpy

input_features = r"C:\GIS_Data\Project\input.gdb\land_units"
output_features = r"C:\GIS_Data\Project\output.gdb\project_boundary"

arcpy.management.Dissolve(
    in_features=input_features,
    out_feature_class=output_features,
    dissolve_field=None,
    multi_part="MULTI_PART"
)

This is useful for creating an overall project boundary or a study-area outline. It can also create a very large geometry. If the result is difficult to draw, edit, or process, use single-part output or divide the geometry with the Dice tool rather than repeatedly dissolving the same output.

Dissolve by one field

The most common workflow is dissolving features that share one field value.

import arcpy

input_features = r"C:\GIS_Data\Project\input.gdb\parcels"
output_features = r"C:\GIS_Data\Project\output.gdb\ownership_areas"

arcpy.management.Dissolve(
    in_features=input_features,
    out_feature_class=output_features,
    dissolve_field=["OWNER_TYPE"],
    multi_part="MULTI_PART"
)

The field should contain values that define the intended groups. Check for spelling differences, leading spaces, inconsistent capitalization, and null values before dissolving. For example, North, NORTH, and North may be treated as different values depending on the data source and field type.

If you need each separate connected area to become its own feature, use SINGLE_PART. If you want all disconnected areas with the same attribute to be represented as one multipart feature, use MULTI_PART.

Dissolve by multiple fields

You can dissolve by a combination of fields. A new group is created for each unique combination of values.

import arcpy

input_features = r"C:\GIS_Data\Project\input.gdb\land_cover"
output_features = r"C:\GIS_Data\Project\output.gdb\land_cover_groups"

arcpy.management.Dissolve(
    in_features=input_features,
    out_feature_class=output_features,
    dissolve_field=["CLASS", "MANAGEMENT_ZONE"],
    multi_part="MULTI_PART"
)

This does not dissolve all features with the same CLASS regardless of management zone. A polygon belongs to a group only when both field values match. Use multiple fields when the combined identity is important, and use a single field when only one classification should control the aggregation.

Add summary statistics during the dissolve

Dissolve can summarize attributes while it aggregates geometry. The statistics field parameter is a value table containing field/statistic pairs. For example, the following script sums parcel area and calculates the mean assessed value for each owner type.

import arcpy

input_features = r"C:\GIS_Data\Project\input.gdb\parcels"
output_features = r"C:\GIS_Data\Project\output.gdb\owner_summary"

statistics_fields = [
    ["PARCEL_AREA", "SUM"],
    ["ASSESSED_VALUE", "MEAN"],
    ["PARCEL_ID", "COUNT"]
]

arcpy.management.Dissolve(
    in_features=input_features,
    out_feature_class=output_features,
    dissolve_field=["OWNER_TYPE"],
    statistics_fields=statistics_fields,
    multi_part="MULTI_PART"
)

The output fields use the statistic and input-field names. For example, a SUM statistic on PARCEL_AREA normally creates SUM_PARCEL_AREA, and a MEAN statistic on ASSESSED_VALUE creates MEAN_ASSESSED_VALUE.

Supported statistics include SUM, MEAN, MIN, MAX, RANGE, STD, COUNT, FIRST, LAST, MEDIAN, VARIANCE, UNIQUE, CONCATENATION, and MODE, subject to the field type and ArcGIS Pro version. Text fields support a smaller set of appropriate statistics. Null values are excluded from statistical calculations. 1

Do not use statistics as a substitute for understanding the field’s units. Summing a field called AREA is meaningful only when its units and geometry source are understood. A mean property value and a sum property value answer different questions.

Multipart versus single-part output

A multipart feature contains multiple disconnected geometry parts stored as one feature. A single-part feature contains one connected geometry per feature.

Use MULTI_PART when:

  • disconnected areas with the same category should share one record;
  • the output will be summarized by group; or
  • reducing the number of records is more important than having one feature per connected area.

Use SINGLE_PART when:

  • each connected area must be selected separately;
  • the output will be edited independently;
  • downstream tools expect one geometry per record; or
  • you need to calculate attributes for each disconnected piece.

Example:

arcpy.management.Dissolve(
    in_features=input_features,
    out_feature_class=output_features,
    dissolve_field=["LAND_USE"],
    multi_part="SINGLE_PART"
)

Multipart output does not mean that the pieces touch each other. It means that separate pieces with the same dissolve values may be stored under one feature record.

A complete production-style workflow

The following example validates the input, creates the output folder if necessary, checks geometry, dissolves the data, and reports the number of output features.

import os
import arcpy

input_features = r"C:\GIS_Data\Project\input.gdb\districts"
output_gdb = r"C:\GIS_Data\Project\results.gdb"
output_features = os.path.join(output_gdb, "districts_dissolved")

if not arcpy.Exists(input_features):
    raise FileNotFoundError(f"Input does not exist: {input_features}")
if not arcpy.Exists(output_gdb):
    raise FileNotFoundError(f"Output geodatabase does not exist: {output_gdb}")

arcpy.env.overwriteOutput = True

# Create a checked copy if the source data is supplied by another workflow.
checked_features = os.path.join("memory", "districts_checked")
arcpy.management.CopyFeatures(input_features, checked_features)
arcpy.management.RepairGeometry(checked_features, delete_null="KEEP_NULL")

arcpy.management.Dissolve(
    in_features=checked_features,
    out_feature_class=output_features,
    dissolve_field=["REGION_ID"],
    statistics_fields=[["POPULATION", "SUM"]],
    multi_part="MULTI_PART"
)

output_count = int(arcpy.management.GetCount(output_features)[0])
print(f"Created {output_count} dissolved features")

Repairing geometry can change invalid input features, so keep an original copy and review the repair messages. Do not assume that repairing geometry is always appropriate without checking the resulting data.

Filter features before dissolving

If only a subset should be dissolved, use a feature layer and a selection rather than creating a permanent filtered copy.

import arcpy

input_features = r"C:\GIS_Data\Project\input.gdb\parcels"
output_features = r"C:\GIS_Data\Project\output.gdb\active_parcels_dissolved"

layer = "parcels_layer"
arcpy.management.MakeFeatureLayer(input_features, layer)
arcpy.management.SelectLayerByAttribute(
    layer,
    "NEW_SELECTION",
    "STATUS = 'Active'"
)

arcpy.management.Dissolve(
    in_features=layer,
    out_feature_class=output_features,
    dissolve_field=["OWNER_TYPE"],
    multi_part="MULTI_PART"
)

Use a safely constructed SQL expression when values come from user input. Field delimiters can vary by workspace, so arcpy.AddFieldDelimiters may be useful in reusable scripts.

Batch dissolve multiple datasets

For repeated processing, wrap the tool call in a function and create valid output names with ValidateTableName.

import os
import arcpy


def dissolve_dataset(input_features, output_gdb, dissolve_fields):
    base_name = os.path.basename(input_features)
    name = os.path.splitext(base_name)[0]
    output_name = arcpy.ValidateTableName(f"{name}_dissolved", output_gdb)
    output_features = os.path.join(output_gdb, output_name)

    arcpy.management.Dissolve(
        in_features=input_features,
        out_feature_class=output_features,
        dissolve_field=dissolve_fields,
        multi_part="MULTI_PART"
    )
    return output_features


input_folder = r"C:\GIS_Data\Project\inputs"
output_gdb = r"C:\GIS_Data\Project\results.gdb"

for filename in arcpy.ListFiles("*.shp"):
    input_features = os.path.join(input_folder, filename)
    try:
        output = dissolve_dataset(input_features, output_gdb, ["CATEGORY"])
        print(f"Completed: {output}")
    except arcpy.ExecuteError:
        print(f"ArcGIS error for {filename}: {arcpy.GetMessages(2)}")

For production processing, write failures to a log and continue only when independent files can safely fail without invalidating the entire result.

Dissolve, Merge, Union, and Append: what is the difference?

These tools solve different problems:

  • Dissolve aggregates features based on shared attributes and removes internal boundaries.
  • Merge combines input datasets into one dataset while generally retaining feature boundaries.
  • Append adds features to an existing target dataset and does not perform geometric aggregation.
  • Union overlays polygon datasets and splits features wherever boundaries intersect, preserving the combined spatial detail.
  • Pairwise Dissolve is an alternative designed for performance and scalability in some workflows.

Choose Dissolve when the desired output is a generalized set of groups. Choose Union when you need to retain the boundaries and attributes from multiple overlapping layers.

Coordinate systems and geometry considerations

Dissolve does not calculate area simply because it combines polygons. If you calculate area before or after the operation, use an appropriate projected coordinate system for the area units you need. Geographic coordinates in degrees are not a suitable basis for interpreting area as square metres or square feet.

If the input features use different coordinate systems, project them deliberately instead of relying on uncontrolled on-the-fly transformations. Set the output coordinate system or project the source data first. Record any geographic transformation used.

Overlapping polygons can produce results that are topologically valid but analytically different from a union or an overlap analysis. Dissolve groups and aggregates features; it does not answer how much area is double-counted by overlap. If overlapping areas need to be resolved, inspect the data and choose an overlay workflow.

Large datasets and very large output features

Dissolving many polygons into a small number of groups can create extremely large geometries. Large features may draw slowly, consume substantial memory, or become difficult to edit. ArcGIS Pro uses tiling for very large datasets, and tile boundaries may remain in output when necessary to prevent an unusable feature. 1

Useful practices include:

  1. Use a file geodatabase instead of shapefiles for complex workflows.
  2. Dissolve only the fields needed for the analysis.
  3. Use SINGLE_PART when a single multipart feature is too large to manage.
  4. Test the workflow on a representative subset before processing the full dataset.
  5. Use the Pairwise Dissolve alternative when its behavior fits the project.
  6. Run Frequency on the result with the dissolve fields when you need to investigate tiling.
  7. Use Dice for extremely large output features when splitting them is acceptable.
  8. Avoid repeatedly dissolving a tiled output in the hope of removing all boundaries; this can be slow or fail because the original geometry exceeded available resources.

Common errors and troubleshooting

The output has more features than expected

Check for spelling, capitalization, whitespace, null values, and differences in multiple dissolve fields. Also check whether SINGLE_PART is creating separate records for disconnected areas.

The output has fewer features than expected

This may be correct if several inputs share the same dissolve values. Review the unique combinations of the dissolve fields before running the tool.

The script cannot find a field

Confirm the exact field name with arcpy.ListFields. Shapefiles have stricter field-name limitations than geodatabase feature classes. Avoid relying on aliases instead of actual field names.

Summary values are not what you expected

Check the statistic type, field units, null values, and whether the input contains duplicate or overlapping features. Null values are excluded from statistics, so COUNT may be lower than the number of features in a group. 1

The result contains multipart features

Set multi_part="SINGLE_PART" if each connected area must be a separate record. Use multipart output only when grouping disconnected pieces under one record is intended.

Dissolve runs out of memory

Reduce the input scope, use a file geodatabase, process in logical groups, use single-part output, or evaluate Pairwise Dissolve. Very large groups can exceed the available memory even when the input feature count is not unusually high.

The tool returns geometry errors

Run CheckGeometry to identify problems and review whether RepairGeometry is appropriate. Keep the original data unchanged and compare the repaired copy before proceeding.

Quality-control checklist

Before delivering a dissolved dataset, verify:

  • the input and output coordinate systems;
  • the exact dissolve fields and unique-value combinations;
  • whether multipart or single-part output is intended;
  • the number of input and output features;
  • the presence of null or inconsistent group values;
  • summary-field names and units;
  • the validity of the output geometry; and
  • whether large features or tiled output require special handling.

Inspect several groups on the map. A script can run successfully while still producing an analytically inappropriate result if the grouping field or geometry assumptions are wrong.

Frequently asked questions

How do I dissolve polygons by an attribute in ArcPy?

Call arcpy.management.Dissolve() and pass the attribute field in dissolve_field, for example dissolve_field=["REGION_ID"].

How do I dissolve all polygons into one feature?

Set dissolve_field=None or omit the dissolve-field argument. The result may be a large multipart or single feature depending on the geometry and multi_part setting.

What is the difference between multipart and single-part dissolve?

Multipart output can store disconnected pieces with the same dissolve values in one record. Single-part output creates a separate feature for each connected part.

Can I calculate statistics during a dissolve?

Yes. Use statistics_fields with field/statistic pairs such as [["POPULATION", "SUM"]]. The resulting field is typically named with the statistic followed by the source field, such as SUM_POPULATION.

Does Dissolve require a Spatial Analyst license?

No. Dissolve is a Data Management tool and is available with Basic, Standard, and Advanced ArcGIS Pro licenses. 1

Should I use Dissolve or Merge?

Use Dissolve when you want shared boundaries removed according to attribute groups. Use Merge when you want to combine datasets while retaining their individual features.

Does Dissolve remove overlapping polygons?

Dissolve aggregates features, but it is not a general overlap-resolution tool. If overlap must be analyzed or partitioned, consider Union or another topology/overlay workflow.

Prepare and normalize the grouping field

A dissolve is only as consistent as the values used to group features. Before running the tool, inspect the grouping field and decide how missing or inconsistent values should be handled. A field containing North, north, and NORTH may create separate groups even though the values are intended to represent the same region. The same problem can occur with trailing spaces, abbreviated names, or coded values that changed between data deliveries.

For repeatable workflows, create a normalized field rather than modifying the original source field. For example, copy a text field to REGION_CLEAN, trim whitespace, and apply a documented case convention. For coded domains, confirm that the stored values—not only the labels shown in the map—are the values being used by the tool.

import arcpy

input_features = r"C:\GIS_Data\Project\input.gdb\districts"
field_name = "REGION_CLEAN"

existing = {field.name.upper() for field in arcpy.ListFields(input_features)}
if field_name.upper() not in existing:
    arcpy.management.AddField(input_features, field_name, "TEXT", field_length=100)

expression = "!REGION_NAME!.strip().upper() if !REGION_NAME! else None"
arcpy.management.CalculateField(
    input_features,
    field_name,
    expression,
    "PYTHON3"
)

Use a normalized field only when that transformation matches the analytical intent. Do not silently combine values that are genuinely different. Keep the original field so the grouping decision remains auditable.

Check the output after dissolving

After the tool completes, inspect both geometry and attributes. A useful validation pattern is to compare the number of unique dissolve-value combinations in the input with the number of records in the multipart output. The counts may differ when null values, empty selections, invalid features, or single-part output affect the result, so treat this as a diagnostic rather than an absolute rule.

import arcpy

input_features = r"C:\GIS_Data\Project\input.gdb\districts"
output_features = r"C:\GIS_Data\Project\output.gdb\districts_dissolved"
field_name = "REGION_ID"

input_values = set()
with arcpy.da.SearchCursor(input_features, [field_name]) as rows:
    for (value,) in rows:
        input_values.add(value)

output_count = int(arcpy.management.GetCount(output_features)[0])
print(f"Input group values: {len(input_values)}")
print(f"Output features: {output_count}")

check_table = r"C:\GIS_Data\Project\output.gdb\dissolve_check"
arcpy.analysis.Frequency(output_features, check_table, [field_name])

Run CheckGeometry on important results and inspect the frequency table when large inputs may have been tiled. If the output will be used for area reporting, calculate the area in an appropriate projected coordinate system after the dissolve and document the units.

Summary

ArcPy’s Dissolve tool is a practical way to aggregate polygons by one or more attributes. A reliable workflow defines the grouping fields carefully, chooses multipart behavior intentionally, specifies statistics when needed, and validates the output geometry and feature counts.

For simple work, the essential call is:

arcpy.management.Dissolve(
    in_features=input_features,
    out_feature_class=output_features,
    dissolve_field=["REGION_ID"]
)

For production work, add input validation, explicit output paths, summary-field documentation, geometry checks, and a record of the ArcGIS Pro version. These steps make the result easier to reproduce and safer to use in later analysis.

References

[1] ArcGIS Pro: Dissolve (Data Management Tools )

[2] ArcGIS Pro: How Dissolve works

Leave a Reply

Gabby Jones

Typically replies within a minute

Hello, Welcome to the site. Please click below button for chating me throught WhatsApp.