get_coordinates
Extract coordinate data from geometric shapes to enable geospatial analysis and mapping applications.
Instructions
Get the coordinates of a geometry.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geometry | Yes |
Implementation Reference
- src/gis_mcp/shapely_functions.py:268-282 (handler)The handler function for the 'get_coordinates' MCP tool. It takes a WKT geometry string, loads it using Shapely, extracts the coordinates using geom.coords, and returns them as a list of lists in a success dictionary. Errors are logged and raised.@gis_mcp.tool() def get_coordinates(geometry: str) -> Dict[str, Any]: """Get the coordinates of a geometry.""" try: from shapely import wkt geom = wkt.loads(geometry) return { "status": "success", "coordinates": [list(coord) for coord in geom.coords], "message": "Coordinates retrieved successfully" } except Exception as e: logger.error(f"Error getting coordinates: {str(e)}") raise ValueError(f"Failed to get coordinates: {str(e)}")