Skip to main content
Glama

rotate_geometry

Rotate geometric shapes by specifying an angle and optional origin point to adjust spatial orientation for GIS analysis.

Instructions

Rotate a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes
angleYes
originNocenter
use_radiansNo

Implementation Reference

  • The core handler function implementing the 'rotate_geometry' tool. It takes WKT geometry string, angle, optional origin and use_radians flag, loads the geometry with shapely.wkt, rotates it using shapely.affinity.rotate, and returns the result as WKT in a success dict or raises error.
    @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)}")

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