Skip to main content
Glama

rotate_geometry

Rotate geometric shapes by a specified angle around a chosen origin, supporting degrees or radians, for precise geospatial adjustments in GIS workflows.

Instructions

Rotate a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
angleYes
geometryYes
originNocenter
use_radiansNo

Implementation Reference

  • Core handler function for the rotate_geometry tool. Converts input WKT geometry to Shapely object, rotates it using shapely.affinity.rotate, and returns the result as WKT.
    @gis_mcp.tool() def rotate_geometry(geometry: str, angle: float, origin: str = "center", use_radians: bool = False) -> Dict[str, Any]: """Rotate a geometry.""" try: from shapely import wkt from shapely.affinity import rotate geom = wkt.loads(geometry) result = rotate(geom, angle=angle, origin=origin, use_radians=use_radians) return { "status": "success", "geometry": result.wkt, "message": "Geometry rotated successfully" } except Exception as e: logger.error(f"Error rotating geometry: {str(e)}") raise ValueError(f"Failed to rotate geometry: {str(e)}")
  • Imports shapely_functions module, triggering registration of rotate_geometry and other tools via @gis_mcp.tool() decorators.
    from . import ( geopandas_functions, shapely_functions, rasterio_functions, pyproj_functions, pysal_functions, )
  • MCP resource listing rotate_geometry as an available transformation operation.
    @gis_mcp.resource("gis://operations/transformations") def get_transformations() -> Dict[str, List[str]]: """List available geometric transformations.""" return { "operations": [ "rotate_geometry", "scale_geometry", "translate_geometry" ] }

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