Skip to main content
Glama

get_area

Calculate the area of a geometric shape using GIS data. Input geometry to obtain accurate spatial measurements for analysis and planning.

Instructions

Get the area of a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes

Implementation Reference

  • The handler function for the 'get_area' MCP tool. It takes a WKT geometry string, loads it with shapely.wkt.loads, computes the area using geom.area, and returns a dictionary with status, area, and message. Errors are logged and raised.
    @gis_mcp.tool()
    def get_area(geometry: str) -> Dict[str, Any]:
        """Get the area of a geometry."""
        try:
            from shapely import wkt
            geom = wkt.loads(geometry)
            return {
                "status": "success",
                "area": float(geom.area),
                "message": "Area calculated successfully"
            }
        except Exception as e:
            logger.error(f"Error calculating area: {str(e)}")
            raise ValueError(f"Failed to calculate area: {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