Skip to main content
Glama

transform_coordinates

Convert spatial coordinates between Coordinate Reference Systems (CRS) for accurate geospatial analysis. Define source and target CRS to enable precise coordinate transformations.

Instructions

Transform coordinates between CRS.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coordinatesYes
source_crsYes
target_crsYes

Implementation Reference

  • The primary handler function for the 'transform_coordinates' tool. It takes a list of two floats (x,y), source CRS, and target CRS, uses pyproj.Transformer to perform the transformation, and returns a success dict with transformed coordinates or raises an error.
    @gis_mcp.tool() def transform_coordinates(coordinates: List[float], source_crs: str, target_crs: str) -> Dict[str, Any]: """Transform coordinates between CRS.""" try: from pyproj import Transformer transformer = Transformer.from_crs(source_crs, target_crs, always_xy=True) x, y = coordinates x_transformed, y_transformed = transformer.transform(x, y) return { "status": "success", "coordinates": [x_transformed, y_transformed], "source_crs": source_crs, "target_crs": target_crs, "message": "Coordinates transformed successfully" } except Exception as e: logger.error(f"Error transforming coordinates: {str(e)}") raise ValueError(f"Failed to transform coordinates: {str(e)}")
  • MCP resource that registers and lists 'transform_coordinates' as an available operation under CRS transformations for tool discovery.
    @gis_mcp.resource("gis://crs/transformations") def get_crs_transformations() -> Dict[str, List[str]]: """List available CRS transformation operations.""" return { "operations": [ "transform_coordinates", "project_geometry" ] }
  • Function signature defining the input schema (coordinates: List[float], source_crs: str, target_crs: str) and output (Dict[str, Any]) for the tool.
    def transform_coordinates(coordinates: List[float], source_crs: str, target_crs: str) -> Dict[str, Any]:

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