import { OpenAssistantTool } from '@openassistant/utils'; import { z } from 'zod'; import { SpatialToolContext } from '../types'; export type BufferFunctionArgs = z.ZodObject<{ geojson: z.ZodOptional; datasetName: z.ZodOptional; distance: z.ZodNumber; distanceUnit: z.ZodEnum<['KM', 'Mile']>; pointsPerCircle: z.ZodOptional; }>; export type BufferLlmResult = { success: boolean; result: string; }; export type BufferAdditionalData = { datasetName?: string; [outputDatasetName: string]: unknown; distance: number; distanceUnit: 'KM' | 'Mile'; pointsPerCircle: number; }; /** * ## buffer Tool * * This tool creates buffer zones around geometries. * It's useful for creating zones of influence, safety perimeters, or proximity analysis around spatial features. * * ### Buffer Creation * * The tool supports creating buffers around various geometry types: * - **Points**: Creates circular buffers around point locations * - **Lines**: Creates buffers along line features (e.g., roads, rivers) * - **Polygons**: Creates buffers around polygon boundaries * * ### Parameters * - `datasetName`: Name of the dataset with geometries to be buffered (optional) * - `geojson`: GeoJSON string of geometries to be buffered (optional) * - `distance`: Buffer distance in the specified unit * - `distanceUnit`: Unit for buffer distance - 'KM' for kilometers or 'Mile' for miles * - `pointsPerCircle`: Smoothness of the buffer (10 = rough, 20 = smooth) * * **Example user prompts:** * - "Can you create a 5km buffer around these roads?" * - "Create a 1-mile buffer around the school locations" * - "Generate a 500-meter buffer around the city boundaries" * * ### Example * ```typescript * import { buffer } from "@openassistant/geoda"; * import { convertToVercelAiTool } from "@openassistant/utils"; * * const bufferTool = { * ...buffer, * 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 create a 5km buffer around these roads?', * tools: { buffer: convertToVercelAiTool(bufferTool) }, * }); * ``` * * :::tip * You can also use this tool with other tools, e.g. geocoding, so you don't need to provide the `getGeometries` function. * The geometries from geocoding tool will be used as the input for this tool. * ::: */ export declare const buffer: OpenAssistantTool; export type BufferTool = typeof buffer;