get_bounds
Calculate the bounding coordinates of a geographic shape to define its spatial extent for mapping and analysis.
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 as a list in a success dictionary.@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)}")
- src/gis_mcp/main.py:66-72 (registration)Imports the shapely_functions module in the main entry point, triggering the @gis_mcp.tool() decorators to register the get_bounds tool with the FastMCP instance.from . import ( geopandas_functions, shapely_functions, rasterio_functions, pyproj_functions, pysal_functions, )