voronoi
Generate Voronoi diagrams from point data to visualize spatial proximity and territory allocation for geospatial analysis.
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:372-387 (handler)The handler function for the 'voronoi' tool. It takes a WKT string of points, computes the Voronoi diagram using shapely.ops.voronoi_diagram, and returns the result as WKT.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:51-59 (registration)Resource listing that registers 'voronoi' as an available advanced GIS operation.def get_advanced_operations() -> Dict[str, List[str]]: """List available advanced operations.""" return { "operations": [ "triangulate_geometry", "voronoi", "unary_union_geometries" ] }