voronoi
Generate Voronoi diagrams from point data to analyze spatial patterns and regions, enabling precise geospatial analysis for decision-making.
Instructions
Create a Voronoi diagram from points.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geometry | Yes |
Implementation Reference
- src/gis_mcp/shapely_functions.py:371-386 (handler)The handler function for the 'voronoi' MCP tool. It parses input WKT geometry (points), computes Voronoi diagram using shapely.ops.voronoi_diagram, returns WKT result or raises error.@gis_mcp.tool() def voronoi(geometry: str) -> Dict[str, Any]: """Create a Voronoi diagram from points.""" try: from shapely import wkt from shapely.ops import voronoi_diagram geom = wkt.loads(geometry) result = voronoi_diagram(geom) return { "status": "success", "geometry": result.wkt, "message": "Voronoi diagram created successfully" } except Exception as e: logger.error(f"Error creating Voronoi diagram: {str(e)}") raise ValueError(f"Failed to create Voronoi diagram: {str(e)}")
- src/gis_mcp/shapely_functions.py:50-59 (registration)Resource listing that includes 'voronoi' as an available advanced operation, indicating its registration in the MCP toolset.@gis_mcp.resource("gis://operations/advanced") def get_advanced_operations() -> Dict[str, List[str]]: """List available advanced operations.""" return { "operations": [ "triangulate_geometry", "voronoi", "unary_union_geometries" ] }