# Dissolve Worker Processes dissolve operations to merge features based on attribute values. ## Overview The dissolve worker merges adjacent or overlapping features that share the same attribute value, optionally aggregating numeric fields. ## Job Type `dissolve` ## Input Parameters ```json { "source_dataset_id": 123, "output_dataset_id": 124, "dissolve_mode": "field", "dissolve_field": "category", "aggregation_fields": { "population": "sum", "area": "sum" } } ``` ### Parameters - `source_dataset_id` (required): Source dataset ID - `output_dataset_id` (required): Output dataset ID - `dissolve_mode` (optional): "all", "field", or "custom" (default: "field") - `dissolve_field` (required if mode="field"): Field to dissolve on - `custom_field` (required if mode="custom"): Field for custom grouping - `custom_groups` (required if mode="custom"): Array of group definitions - `aggregation_fields` (optional): Object mapping field names to aggregation functions (sum, avg, min, max, count) ## Output Creates a new dataset with dissolved features: - Merged geometries for each group - Aggregated attribute values - Group identifiers ## Dissolve Modes ### All Features Merge all features into a single feature. No grouping field required. ### By Field Merge features that share the same value in the specified field. ### Custom Groups Merge features based on custom group definitions. Allows complex grouping logic. ## Aggregation Functions - `sum`: Sum of numeric values - `avg`: Average of numeric values - `min`: Minimum value - `max`: Maximum value - `count`: Count of features ## Example ```bash # Enqueue a dissolve job via API curl -X POST "https://example.com/api/run_dissolve.php" \ -H "Content-Type: application/json" \ -d '{ "source_dataset_id": 123, "output_dataset_id": 124, "dissolve_mode": "field", "dissolve_field": "category", "aggregation_fields": { "population": "sum", "area": "sum" } }' ``` ## Background Jobs This analysis runs as a background job. The worker: 1. Fetches queued `dissolve` jobs 2. Validates input parameters 3. Executes PostGIS dissolve queries 4. Applies aggregations 5. Creates output dataset 6. Marks job as completed ## Performance Considerations - Processing time depends on dataset size and number of groups - Complex geometries may slow processing - Aggregation operations add processing time - Consider simplifying geometries before dissolving ## Related Documentation - [Dissolve Analysis Tool](../analysis-tools/dissolve.md) - [Analysis API](../api/analysis.md) - [Workers Overview](index.md)