Skip to main content
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

Parameters

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.
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.
bool
default:"True"
Place grouping columns in the result index.
int, name, or sequence
default:"None"
Group by one or more input index levels. When supplied, level takes precedence over by, matching pandas.
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.
bool
default:"False"
For categorical groupers, True returns observed groups. Materializing unobserved categorical combinations is unsupported.
bool
default:"True"
Drop null grouping keys when true.
Literal['unary', 'coverage', 'disjoint_subset']
default:"'unary'"
Union algorithm. Sedona currently supports only the robust unary union for this API.
None
default:"None"
Fixed-precision union is not currently supported.
numeric_only is supported for non-dict aggregations.

Returns

GeoDataFrame
A distributed GeoDataFrame with one row per group.
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.

Examples