Skip to main content
Glama

calculate_geodetic_area

Calculate polygon area using geodetic methods for accurate geospatial analysis in GIS applications.

Instructions

Calculate area of a polygon using geodetic calculations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes
ellpsNoWGS84

Implementation Reference

  • Main handler function for the 'calculate_geodetic_area' tool. Parses WKT geometry, uses pyproj.Geod.geometry_area_perimeter to compute the geodetic area on the specified ellipsoid, and returns the result in square meters.
    @gis_mcp.tool()
    def calculate_geodetic_area(geometry: str, ellps: str = "WGS84") -> Dict[str, Any]:
        """Calculate area of a polygon using geodetic calculations."""
        try:
            import pyproj
            from shapely import wkt
            geod = pyproj.Geod(ellps=ellps)
            polygon = wkt.loads(geometry)
            area = abs(geod.geometry_area_perimeter(polygon)[0])
            return {
                "status": "success",
                "area": float(area),
                "ellps": ellps,
                "unit": "square_meters",
                "message": "Geodetic area calculated successfully"
            }
        except Exception as e:
            logger.error(f"Error calculating geodetic area: {str(e)}")
            raise ValueError(f"Failed to calculate geodetic area: {str(e)}")
  • Resource listing that includes 'calculate_geodetic_area' as one of the available geodetic operations.
    @gis_mcp.resource("gis://crs/geodetic")
    def get_geodetic_operations() -> Dict[str, List[str]]:
        """List available geodetic operations."""
        return {
            "operations": [
                "get_geod_info",
                "calculate_geodetic_distance",
                "calculate_geodetic_point",
                "calculate_geodetic_area"
            ]
        }

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