scale_geometry
Scale a geometry by applying specified x and y factors to adjust its size, useful for resizing spatial features in geospatial analysis.
Instructions
Scale a geometry.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geometry | Yes | ||
| origin | No | center | |
| xfact | Yes | ||
| yfact | Yes |
Implementation Reference
- src/gis_mcp/shapely_functions.py:317-333 (handler)The handler function for the 'scale_geometry' tool. It takes a WKT geometry string and scaling factors, uses Shapely's affinity.scale to scale the geometry, and returns the result as WKT in a success dictionary.@gis_mcp.tool() def scale_geometry(geometry: str, xfact: float, yfact: float, origin: str = "center") -> Dict[str, Any]: """Scale a geometry.""" try: from shapely import wkt from shapely.affinity import scale geom = wkt.loads(geometry) result = scale(geom, xfact=xfact, yfact=yfact, origin=origin) return { "status": "success", "geometry": result.wkt, "message": "Geometry scaled successfully" } except Exception as e: logger.error(f"Error scaling geometry: {str(e)}") raise ValueError(f"Failed to scale geometry: {str(e)}")