get_bounds
Retrieve the bounding box coordinates of a specified geometry. Use this to define the spatial extent for geospatial analysis and mapping within the GIS MCP Server.
Instructions
Get the bounds of a geometry.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geometry | Yes |
Implementation Reference
- src/gis_mcp/shapely_functions.py:253-266 (handler)The handler function for the 'get_bounds' tool. It parses a WKT geometry string using Shapely, computes the bounds (minx, miny, maxx, maxy), and returns them in a success dictionary or raises an error.@gis_mcp.tool() def get_bounds(geometry: str) -> Dict[str, Any]: """Get the bounds of a geometry.""" try: from shapely import wkt geom = wkt.loads(geometry) return { "status": "success", "bounds": list(geom.bounds), "message": "Bounds calculated successfully" } except Exception as e: logger.error(f"Error calculating bounds: {str(e)}") raise ValueError(f"Failed to calculate bounds: {str(e)}")