Variable: thiessenPolygons
const
thiessenPolygons:ExtendedTool
<ThiessenPolygonsArgs
,ThiessenPolygonsLlmResult
,ThiessenPolygonsAdditionalData
,SpatialToolContext
>
Defined in: packages/tools/geoda/src/spatial_ops/thiessenPolygons.ts:48
thiessenPolygons Tool
This tool generates thiessen polygons or voronoi diagrams from a given dataset or geojson.
Thiessen Polygons Generation
It supports both direct geojson input and dataset names.
Example user prompts:
- "Generate thiessen polygons for this dataset"
Example Code
import { thiessenPolygons, ThiessenPolygonsTool } from '@openassistant/geoda';
import { convertToVercelAiTool } from '@openassistant/utils';
import { generateText } from 'ai';
const thiessenPolygonsTool: ThiessenPolygonsTool = {
...thiessenPolygons,
context: {
getGeometries: (datasetName) => {
return getGeometries(datasetName);
},
},
onToolCompleted: (toolCallId, additionalData) => {
console.log(toolCallId, additionalData);
// do something like save the thiessen polygons result in additionalData
},
};
generateText({
model: openai('gpt-4o-mini', { apiKey: key }),
prompt: 'Generate thiessen polygons for this dataset',
tools: { thiessenPolygons: convertToVercelAiTool(thiessenPolygonsTool) },
});