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
| Name | Required | Description | Default |
|---|---|---|---|
| geometry | Yes |
Implementation Reference
- src/gis_mcp/shapely_functions.py:221-236 (handler)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)}")