normalize_geometry
Standardize the orientation and order of geometric data in WKT format for consistent analysis and processing within the GIS MCP Server environment.
Instructions
Normalize the orientation/order of a geometry using shapely.normalize.
Args:
geometry: WKT string of the geometry.
Returns:
Dictionary with status, message, and normalized geometry as WKT.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geometry | Yes |
Implementation Reference
- src/gis_mcp/shapely_functions.py:537-558 (handler)The main execution handler for the 'normalize_geometry' tool. It takes a WKT geometry string, normalizes it using Shapely's normalize function, and returns the result as WKT with status.@gis_mcp.tool() def normalize_geometry(geometry: str) -> Dict[str, Any]: """ Normalize the orientation/order of a geometry using shapely.normalize. Args: geometry: WKT string of the geometry. Returns: Dictionary with status, message, and normalized geometry as WKT. """ try: from shapely import wkt, normalize geom = wkt.loads(geometry) normalized = normalize(geom) return { "status": "success", "geometry": normalized.wkt, "message": "Geometry normalized successfully" } except Exception as e: logger.error(f"Error in normalize_geometry: {str(e)}") return {"status": "error", "message": str(e)}
- src/gis_mcp/shapely_functions.py:82-93 (registration)Resource registration that lists 'normalize_geometry' among available Shapely utility operations for discovery.@gis_mcp.resource("gis://operations/shapely_util") def get_shapely_util_operations() -> Dict[str, List[str]]: """List available Shapely utility/advanced operations.""" return { "operations": [ "snap_geometry", "nearest_point_on_geometry", "normalize_geometry", "geometry_to_geojson", "geojson_to_geometry" ] }
- Specific entry registering 'normalize_geometry' in the list of available operations."normalize_geometry",