get_geocentric_crs
Convert geographic coordinates to geocentric coordinate reference systems for accurate 3D spatial analysis and transformations in GIS workflows.
Instructions
Get geocentric CRS for given coordinates.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coordinates | Yes |
Implementation Reference
- src/gis_mcp/pyproj_functions.py:323-344 (handler)The core handler function for the 'get_geocentric_crs' tool. It returns the fixed WGS 84 geocentric CRS (EPSG:4978) by parsing the input coordinates but not using them for CRS selection.@gis_mcp.tool() def get_geocentric_crs(coordinates: List[float]) -> Dict[str, Any]: """Get geocentric CRS for given coordinates.""" try: import pyproj from pyproj.database import query_crs_info lon, lat = coordinates # Query for geocentric CRS (type PJType.GEOCENTRIC_CRS) # Since query_geocentric_crs_info doesn't exist, use a standard geocentric CRS # WGS 84 geocentric is a common choice: EPSG:4978 crs_obj = pyproj.CRS.from_epsg(4978) # WGS 84 geocentric return { "status": "success", "crs": crs_obj.to_string(), "message": "Geocentric CRS retrieved successfully" } except Exception as e: logger.error(f"Error getting geocentric CRS: {str(e)}") raise ValueError(f"Failed to get geocentric CRS: {str(e)}")
- src/gis_mcp/main.py:66-72 (registration)Import of pyproj_functions module in the main entry point, which executes the @gis_mcp.tool() decorators to register the 'get_geocentric_crs' tool with the MCP server.from . import ( geopandas_functions, shapely_functions, rasterio_functions, pyproj_functions, pysal_functions, )
- MCP resource that lists 'get_geocentric_crs' as one of the available CRS operations, aiding tool discovery.@gis_mcp.resource("gis://crs/info") def get_crs_info_operations() -> Dict[str, List[str]]: """List available CRS information operations.""" return { "operations": [ "get_crs_info", "get_available_crs", "get_utm_zone", "get_utm_crs", "get_geocentric_crs" ] }
- src/gis_mcp/mcp.py:1-6 (registration)Definition of the gis_mcp FastMCP instance used by decorators to register tools including 'get_geocentric_crs'.# MCP imports using the new SDK patterns from fastmcp import FastMCP gis_mcp = FastMCP("GIS MCP")