import { OpenAssistantTool } from '@openassistant/utils'; import { z } from 'zod'; import { SpatialToolContext } from '../types'; export type DissolveFunctionArgs = z.ZodObject<{ geojson: z.ZodOptional; datasetName: z.ZodOptional; dissolveBy: z.ZodOptional; aggregateVariables: z.ZodOptional; }>>>; }>; export type DissolveLlmResult = { success: boolean; result: string; }; export type DissolveAdditionalData = { datasetName?: string; [outputDatasetName: string]: unknown; }; /** * ## dissolve Tool * * This tool merges multiple geometries into a single geometry by dissolving boundaries. * It's useful for aggregating smaller administrative units into larger regions or creating simplified boundaries. * * ### Dissolve Operations * * The tool supports various dissolve operations: * - **Complete Dissolve**: Merges all geometries into a single geometry * - **Dissolve by Attribute**: Groups geometries by a common attribute value * - **Aggregated Dissolve**: Combines geometries and aggregates associated values * * ### Parameters * - `datasetName`: Name of the dataset with geometries to be dissolved (optional) * - `geojson`: GeoJSON string of geometries to be dissolved (optional) * - `dissolveBy`: Variable to dissolve by (optional, dissolves entire dataset if not provided) * - `aggregateVariables`: Variables to aggregate during dissolve with their operators (optional) * * **Example user prompts:** * - "Can you merge these counties into a single region?" * - "Dissolve the census tracts by state and sum the population" * - "Combine all the polygons into one geometry" * * ### Example * ```typescript * import { dissolve } from "@openassistant/geoda"; * import { convertToVercelAiTool } from "@openassistant/utils"; * * const dissolveTool = { * ...dissolve, * context: { * getGeometries: async (datasetName: string) => { * // Implementation to retrieve geometries from your data source * return geometries; * }, * getValues: async (datasetName: string, variableName: string) => { * // Implementation to retrieve values from your data source * return [100, 200, 150, 300, 250]; * }, * }, * }; * * const result = await generateText({ * model: openai('gpt-4.1', { apiKey: key }), * prompt: 'Can you merge these counties into a single region?', * tools: { dissolve: convertToVercelAiTool(dissolveTool) }, * }); * ``` */ export declare const dissolve: OpenAssistantTool; export type DissolveTool = typeof dissolve;