union
Combine two geometries to create a single unified shape for spatial analysis in GIS operations.
Instructions
Combine two geometries.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geometry1 | Yes | ||
| geometry2 | Yes |
Implementation Reference
- src/gis_mcp/shapely_functions.py:137-152 (handler)The handler function for the 'union' MCP tool. It takes two WKT geometry strings, computes their union using Shapely, and returns the result as WKT with status.@gis_mcp.tool() def union(geometry1: str, geometry2: str) -> Dict[str, Any]: """Combine two geometries.""" try: from shapely import wkt geom1 = wkt.loads(geometry1) geom2 = wkt.loads(geometry2) result = geom1.union(geom2) return { "status": "success", "geometry": result.wkt, "message": "Union created successfully" } except Exception as e: logger.error(f"Error creating union: {str(e)}") raise ValueError(f"Failed to create union: {str(e)}")