Skip to main content
Glama

minimum_rotated_rectangle

Calculate the smallest rotated rectangle that encloses a geometry, useful for bounding box analysis and spatial orientation in GIS workflows.

Instructions

Get minimum rotated rectangle of a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes

Implementation Reference

  • The handler function for the 'minimum_rotated_rectangle' tool. It takes a WKT geometry string, loads it with shapely.wkt.loads, computes the minimum rotated rectangle using geom.minimum_rotated_rectangle, and returns the result as WKT in a success dictionary.
    @gis_mcp.tool()
    def minimum_rotated_rectangle(geometry: str) -> Dict[str, Any]:
        """Get minimum rotated rectangle of a geometry."""
        try:
            from shapely import wkt
            geom = wkt.loads(geometry)
            result = geom.minimum_rotated_rectangle
            return {
                "status": "success",
                "geometry": result.wkt,
                "message": "Minimum rotated rectangle created successfully"
            }
        except Exception as e:
            logger.error(f"Error creating minimum rotated rectangle: {str(e)}")
            raise ValueError(f"Failed to create minimum rotated rectangle: {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