get_geod_info
Retrieve geodetic calculation parameters like ellipsoid dimensions and flattening for accurate coordinate transformations in GIS analysis.
Instructions
Get information about a geodetic calculation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ellps | No | WGS84 | |
| a | No | ||
| b | No | ||
| f | No |
Implementation Reference
- src/gis_mcp/pyproj_functions.py:154-177 (handler)The handler function for the 'get_geod_info' tool, decorated with @gis_mcp.tool(). It creates a pyproj.Geod object and returns ellipsoid parameters (a, b, f, es, e).@gis_mcp.tool() def get_geod_info(ellps: str = "WGS84", a: Optional[float] = None, b: Optional[float] = None, f: Optional[float] = None) -> Dict[str, Any]: """Get information about a geodetic calculation.""" try: import pyproj geod = pyproj.Geod(ellps=ellps, a=a, b=b, f=f) # Calculate e (eccentricity) from es (first eccentricity squared) e = (geod.es ** 0.5) if geod.es >= 0 else None return { "status": "success", "ellps": ellps, # Return the parameter, not attribute "ellipsoid": ellps, # Also include as ellipsoid for compatibility "a": geod.a, "b": geod.b, "f": geod.f, "es": geod.es, "e": e, "message": "Geodetic information retrieved successfully" } except Exception as e: logger.error(f"Error getting geodetic info: {str(e)}") raise ValueError(f"Failed to get geodetic info: {str(e)}")
- src/gis_mcp/main.py:66-72 (registration)Import of pyproj_functions.py in the main entry point, which executes the @gis_mcp.tool() decorators to register the 'get_geod_info' tool with the FastMCP instance.from . import ( geopandas_functions, shapely_functions, rasterio_functions, pyproj_functions, pysal_functions, )
- GIS resource that lists 'get_geod_info' as one of the available geodetic operations for discovery.@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" ] }