Skip to main content
Glama

project_geometry

Transform geometric data between Coordinate Reference Systems (CRS) to ensure accurate spatial analysis and alignment in GIS workflows.

Instructions

Project a geometry between CRS.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes
source_crsYes
target_crsYes

Implementation Reference

  • The main handler function for the 'project_geometry' MCP tool. It parses WKT geometry, uses pyproj.Transformer to project coordinates, applies shapely.ops.transform, and returns the projected WKT geometry.
    @gis_mcp.tool() def project_geometry(geometry: str, source_crs: str, target_crs: str) -> Dict[str, Any]: """Project a geometry between CRS.""" try: from shapely import wkt from shapely.ops import transform from pyproj import Transformer geom = wkt.loads(geometry) transformer = Transformer.from_crs(source_crs, target_crs, always_xy=True) projected = transform(transformer.transform, geom) return { "status": "success", "geometry": projected.wkt, "source_crs": source_crs, "target_crs": target_crs, "message": "Geometry projected successfully" } except Exception as e: logger.error(f"Error projecting geometry: {str(e)}") raise ValueError(f"Failed to project geometry: {str(e)}")
  • Resource endpoint listing 'project_geometry' as an available CRS transformation operation.
    @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" ] }
  • Helper function _project_geometry_to used in land cover tools for projecting geometries, similar logic to the main tool.
    def _project_geometry_to(to_crs: str, geom, from_crs: str = "EPSG:4326"): transformer = Transformer.from_crs(from_crs, to_crs, always_xy=True) return shapely_transform(lambda x, y: transformer.transform(x, y), geom)

Other Tools

Related Tools

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