symmetric_difference
Calculate the symmetric difference between two geometries to identify areas unique to each, using the GIS MCP Server for precise geospatial analysis and comparison.
Instructions
Find symmetric difference between geometries.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geometry1 | Yes | ||
| geometry2 | Yes |
Implementation Reference
- src/gis_mcp/shapely_functions.py:171-187 (handler)The handler function for the 'symmetric_difference' tool. It takes two WKT geometry strings, loads them using Shapely, computes the symmetric difference, and returns the result as WKT in a success dict or raises an error.@gis_mcp.tool() def symmetric_difference(geometry1: str, geometry2: str) -> Dict[str, Any]: """Find symmetric difference between geometries.""" try: from shapely import wkt geom1 = wkt.loads(geometry1) geom2 = wkt.loads(geometry2) result = geom1.symmetric_difference(geom2) return { "status": "success", "geometry": result.wkt, "message": "Symmetric difference created successfully" } except Exception as e: logger.error(f"Error creating symmetric difference: {str(e)}") raise ValueError(f"Failed to create symmetric difference: {str(e)}")