import { OpenAssistantTool } from '@openassistant/utils'; import { z } from 'zod'; import { SpatialToolContext } from '../types'; export type GridFunctionArgs = z.ZodObject<{ datasetName: z.ZodOptional; mapBounds: z.ZodOptional; southeast: z.ZodObject<{ longitude: z.ZodNumber; latitude: z.ZodNumber; }>; }>>; rows: z.ZodNumber; columns: z.ZodNumber; }>; export type GridLlmResult = { success: boolean; result: string; gridInfo: { rows: number; columns: number; totalCells: number; bounds: { minX: number; minY: number; maxX: number; maxY: number; }; }; }; export type GridAdditionalData = { datasetName?: string; mapBounds?: { northwest: { longitude: number; latitude: number; }; southeast: { longitude: number; latitude: number; }; }; [outputDatasetName: string]: unknown; }; /** * ## grid Tool * * This tool creates a grid of polygons that divides a given area into N rows and M columns. * It's useful for spatial analysis, creating regular grids for sampling, or dividing areas into equal sections. * * ### Grid Creation * * The tool creates regular grids with the following features: * - **Customizable Dimensions**: Specify number of rows and columns * - **Boundary-based**: Create grids within dataset boundaries or map view bounds * - **Equal-sized Cells**: Each grid cell has equal area * - **Spatial Reference**: Maintains proper coordinate system * * ### Parameters * - `datasetName`: Name of the dataset with boundary geometry to create grid within (optional) * - `mapBounds`: Map bounds defined by northwest and southeast coordinates (optional) * - `rows`: Number of rows in the grid (N) * - `columns`: Number of columns in the grid (M) * * **Example user prompts:** * - "Create a 5x5 grid over this area" * - "Divide this region into a 10 by 8 grid" * - "Generate a grid with 6 rows and 4 columns for this boundary" * - "Create a 3x3 grid for the current map view" * * ### Example * ```typescript * import { grid } from "@openassistant/geoda"; * import { convertToVercelAiTool } from "@openassistant/utils"; * * const gridTool = { * ...grid, * 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: 'Create a 5x5 grid over this area', * tools: { grid: convertToVercelAiTool(gridTool) }, * }); * ``` */ export declare const grid: OpenAssistantTool; export type GridTool = typeof grid;