Skip to main content
Glama

convex_hull

Calculate the convex hull of a geometry to determine the smallest convex polygon that contains all points, useful for spatial analysis and boundary definition in GIS applications.

Instructions

Calculate convex hull of a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes

Implementation Reference

  • The handler function that implements the 'convex_hull' tool logic. It parses WKT input, computes the convex hull using Shapely.geometry.convex_hull, and returns the result as WKT.
    @gis_mcp.tool()
    def convex_hull(geometry: str) -> Dict[str, Any]:
        """Calculate convex hull of a geometry."""
        try:
            from shapely import wkt
            geom = wkt.loads(geometry)
            result = geom.convex_hull
            return {
                "status": "success",
                "geometry": result.wkt,
                "message": "Convex hull created successfully"
            }
        except Exception as e:
            logger.error(f"Error creating convex hull: {str(e)}")
            raise ValueError(f"Failed to create convex hull: {str(e)}")
  • Resource listing that includes 'convex_hull' as an available geometric operation, aiding in tool discovery.
    @gis_mcp.resource("gis://operations/geometric")
    def get_geometric_properties() -> Dict[str, List[str]]:
        """List available geometric property operations."""
        return {
            "operations": [
                "convex_hull",
                "envelope",
                "minimum_rotated_rectangle",
                "get_centroid",
                "get_bounds",
                "get_coordinates",
                "get_geometry_type"
            ]
        }

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