> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GeoDataFrame.dissolve

> Dissolve geometries within groups using distributed aggregation.

Dissolve geometries within groups using distributed aggregation.

Geometry unions are evaluated by Sedona's `ST_Union_Aggr` aggregate.
Attribute columns use validated native Spark aggregate expressions and
therefore remain distributed as well.

## Signature

```python theme={"system"}
dissolve(
    by=None,
    aggfunc='first',
    as_index: bool = True,
    level=None,
    sort: bool = True,
    observed: bool = False,
    dropna: bool = True,
    method: Literal['unary', 'coverage', 'disjoint_subset'] = 'unary',
    grid_size=None,
    **kwargs,
) -> GeoDataFrame
```

## Parameters

<ParamField path="by" type="column label or list of column labels" default="None">
  Columns defining the groups. `None` dissolves all rows into one
  group. Arbitrary driver-side grouping vectors are not supported.
</ParamField>

<ParamField path="aggfunc" type="str, callable, list, or dict" default="'first'">
  Aggregation(s) for non-geometry columns. `first`, `last`, and
  `count` support every Spark data type. `nunique` supports
  numeric, boolean, and string columns. `min`, `max`, `sum`,
  `mean`, `median`, `std`, and `var` support numeric and
  boolean columns. String `sum` and every `prod` aggregation are
  not supported.
</ParamField>

<ParamField path="as_index" type="bool" default="True">
  Place grouping columns in the result index.
</ParamField>

<ParamField path="level" type="int, name, or sequence" default="None">
  Group by one or more input index levels. When supplied, `level`
  takes precedence over `by`, matching pandas.
</ParamField>

<ParamField path="sort" type="bool" default="True">
  Sort group keys. With `False`, groups follow first occurrence.
  Preserving that order still requires a distributed sort by each
  group's first source-row position.
</ParamField>

<ParamField path="observed" type="bool" default="False">
  For categorical groupers, `True` returns observed groups.
  Materializing unobserved categorical combinations is unsupported.
</ParamField>

<ParamField path="dropna" type="bool" default="True">
  Drop null grouping keys when true.
</ParamField>

<ParamField path="method" type="Literal['unary', 'coverage', 'disjoint_subset']" default="'unary'">
  Union algorithm. Sedona currently supports only the robust unary
  union for this API.
</ParamField>

<ParamField path="grid_size" type="None" default="None">
  Fixed-precision union is not currently supported.
</ParamField>

<ParamField path="kwargs">
  `numeric_only` is supported for non-dict aggregations.
</ParamField>

## Returns

<ResponseField name="return" type="GeoDataFrame">
  A distributed GeoDataFrame with one row per group.
</ResponseField>

<Note>
  Python row UDFs are not used. Callable aliases are limited to built-in
  `min`, `max`, and `sum`, plus NumPy `amin`, `amax`, `min`,
  `max`, `sum`, `mean`, `median`, `std`, and `var`.
  `first` and `last` follow source row order and skip null and NaN
  values. Numeric and boolean `sum` use pandas' zero identity for an
  all-null group; boolean sums are returned as integers and boolean
  statistical aggregations as floating-point values.

  GeoPandas flattens multiple aggregation labels into a one-level object
  index containing tuples. pandas-on-Spark cannot represent tuple-valued
  labels in a one-level column index, so Sedona keeps those results as a
  two-level `MultiIndex` and uses `(geometry_name, "")` for the
  active geometry label.
</Note>

## Examples

```python theme={"system"}
>>> from sedona.spark.geopandas import GeoDataFrame
>>> from shapely.geometry import Point
>>> gdf = GeoDataFrame(
...     {
...         "zone": ["a", "a", "b"],
...         "value": [1, 2, 3],
...         "geometry": [Point(0, 0), Point(1, 1), Point(5, 5)],
...     },
...     crs="EPSG:4326",
... )
>>> gdf.dissolve("zone", aggfunc="sum").sort_index()
                          geometry  value
zone
a     MULTIPOINT ((0 0), (1 1))      3
b                   POINT (5 5)      3
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.