Skip to main content
Glama

convex_hull

Calculate the convex hull of a given geometry to identify the smallest convex polygon that fully encloses its points. Use this tool to perform accurate geospatial analysis and simplify complex shapes in GIS applications.

Instructions

Calculate convex hull of a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes

Implementation Reference

  • The main handler function for the 'convex_hull' MCP tool, decorated with @gis_mcp.tool(). It takes a WKT geometry string, computes its convex hull using Shapely, 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 handler that lists 'convex_hull' as one of the available geometric property operations.
    @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" ] }

Other Tools

Related Tools

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