union
Merge two geometries into a single combined shape using the GIS MCP Server, facilitating precise geospatial analysis and data integration for enhanced mapping and spatial insights.
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 primary handler for the 'union' tool. It takes two WKT geometry strings, computes their geometric union using Shapely's union method, and returns the result as WKT with status information.@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)}")