Skip to main content
Glama

union

Combine two geometries to create a single unified shape for spatial analysis in GIS operations.

Instructions

Combine two geometries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometry1Yes
geometry2Yes

Implementation Reference

  • 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)}")

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