Skip to main content
Glama

transform_coordinates

Convert geographic coordinates between different coordinate reference systems (CRS) for accurate spatial data alignment and analysis.

Instructions

Transform coordinates between CRS.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coordinatesYes
source_crsYes
target_crsYes

Implementation Reference

  • The core handler function for the 'transform_coordinates' MCP tool. It takes a list of two floats (x,y), source CRS string, target CRS string, creates a pyproj Transformer, transforms the point, and returns a dict with the result.
    @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)}")

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