Skip to main content
Glama

unary_union_geometries

Combine multiple geometries into a single unified shape for spatial analysis and data simplification in GIS workflows.

Instructions

Create a union of multiple geometries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometriesYes

Implementation Reference

  • The core handler function for the 'unary_union_geometries' tool. It takes a list of WKT geometry strings, computes their unary union using Shapely's unary_union, and returns the resulting geometry as WKT in a success dictionary.
    @gis_mcp.tool()
    def unary_union_geometries(geometries: List[str]) -> Dict[str, Any]:
        """Create a union of multiple geometries."""
        try:
            from shapely import wkt
            from shapely.ops import unary_union
            geoms = [wkt.loads(g) for g in geometries]
            result = unary_union(geoms)
            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)}")
  • Registers 'unary_union_geometries' in the list of available advanced GIS operations accessible via the 'gis://operations/advanced' resource.
    @gis_mcp.resource("gis://operations/advanced")
    def get_advanced_operations() -> Dict[str, List[str]]:
        """List available advanced operations."""
        return {
            "operations": [
                "triangulate_geometry",
                "voronoi",
                "unary_union_geometries"
            ]
        }

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