get_coordinates
Extracts coordinates from a given geometry using the GIS MCP Server, enabling precise geospatial analysis for location-based data processing.
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 primary handler implementation for the 'get_coordinates' MCP tool. Decorated with @gis_mcp.tool() for registration, it parses input WKT geometry using Shapely, extracts coordinates from geom.coords, and returns them in a standardized dict format.@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)}")
- Helper resource endpoint that lists 'get_coordinates' as one of the available geometric property operations, aiding in tool discovery.@gis_mcp.resource("gis://operations/geometric") def get_geometric_properties() -> Dict[str, List[str]]: """List available geometric property operations.""" return { "operations": [ "convex_hull", "envelope", "minimum_rotated_rectangle", "get_centroid", "get_bounds", "get_coordinates", "get_geometry_type" ] }