Skip to main content
Glama

get_utm_crs

Convert geographic coordinates to UTM coordinate reference systems for accurate geospatial mapping and analysis.

Instructions

Get UTM CRS for given coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coordinatesYes

Implementation Reference

  • The core handler function for the 'get_utm_crs' tool, decorated with @gis_mcp.tool(). It uses pyproj to query the UTM CRS info for the given lon/lat coordinates and returns the CRS string representation.
    @gis_mcp.tool()
    def get_utm_crs(coordinates: List[float]) -> Dict[str, Any]:
        """Get UTM CRS for given coordinates."""
        try:
            import pyproj
            from pyproj.database import query_utm_crs_info
            lon, lat = coordinates
            crs_info_list = query_utm_crs_info(
                datum_name="WGS 84",  # Use "WGS 84" with space as per standard
                area_of_interest=pyproj.aoi.AreaOfInterest(
                    west_lon_degree=lon,
                    south_lat_degree=lat,
                    east_lon_degree=lon,
                    north_lat_degree=lat
                )
            )
            if not crs_info_list:
                raise ValueError("No UTM CRS found for the given coordinates")
            
            # Create CRS from CRSInfo and get its string representation
            crs_obj = pyproj.CRS.from_authority(crs_info_list[0].auth_name, crs_info_list[0].code)
            crs_str = crs_obj.to_string()
            
            return {
                "status": "success",
                "crs": crs_str,
                "message": "UTM CRS retrieved successfully"
            }
        except Exception as e:
            logger.error(f"Error getting UTM CRS: {str(e)}")
            raise ValueError(f"Failed to get UTM CRS: {str(e)}")
  • MCP resource endpoint that lists 'get_utm_crs' among the available CRS information operations, serving as a tool directory.
    @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"
            ]
        }

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