import { OpenAssistantTool } from '@openassistant/utils'; import { z } from 'zod'; import { SpatialToolContext } from '../types'; export type CentroidFunctionArgs = z.ZodObject<{ geojson: z.ZodOptional; datasetName: z.ZodOptional; }>; export type CentroidLlmResult = { success: boolean; result: string; }; export type CentroidAdditionalData = { datasetName?: string; [outputDatasetName: string]: unknown; }; /** * ## centroid Tool * * This tool calculates the centroids (geometric centers) of geometries. * Centroids are useful for representing polygon features as points for analysis or visualization. * * ### Centroid Calculation * * The tool calculates centroids for various geometry types: * - **Polygons**: Calculates the geometric center of polygon areas * - **MultiPolygons**: Calculates centroids for each polygon component * - **FeatureCollections**: Calculates centroids for all polygon features * * ### Parameters * - `datasetName`: Name of the dataset with geometries to calculate centroids from (optional) * - `geojson`: GeoJSON string of geometries to calculate centroids from (optional) * * **Example user prompts:** * - "Can you find the center points of these counties?" * - "Calculate centroids for all the polygons" * - "Get the center points of the administrative boundaries" * * ### Example * ```typescript * import { centroid } from "@openassistant/geoda"; * import { convertToVercelAiTool } from "@openassistant/utils"; * * const centroidTool = { * ...centroid, * context: { * getGeometries: async (datasetName: string) => { * // Implementation to retrieve geometries from your data source * return geometries; * }, * }, * }; * * const result = await generateText({ * model: openai('gpt-4.1', { apiKey: key }), * prompt: 'Can you find the center points of these counties?', * tools: { centroid: convertToVercelAiTool(centroidTool) }, * }); * ``` */ export declare const centroid: OpenAssistantTool; export type CentroidTool = typeof centroid;