Skip to main content
Glama

symmetric_difference

Calculate the symmetric difference between two geometries to identify areas that belong exclusively to one geometry or the other, excluding overlapping regions.

Instructions

Find symmetric difference between geometries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometry1Yes
geometry2Yes

Implementation Reference

  • The core handler function for the 'symmetric_difference' tool. It takes two WKT geometry strings, parses them with Shapely, computes the symmetric difference, and returns the result as WKT with status and message.
    @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)}")
  • The @gis_mcp.tool() decorator registers the symmetric_difference function as an MCP tool.
    @gis_mcp.tool()
  • Resource listing that includes 'symmetric_difference' among basic geometric operations, aiding tool discovery.
    @gis_mcp.resource("gis://operations/basic") def get_basic_operations() -> Dict[str, List[str]]: """List available basic geometric operations.""" return { "operations": [ "buffer", "intersection", "union", "difference", "symmetric_difference" ] }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mahdin75/gis-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server