Skip to main content
Glama

scale_geometry

Scale geometric shapes by adjusting X and Y dimensions to resize maps, models, or spatial data for analysis and visualization.

Instructions

Scale a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes
xfactYes
yfactYes
originNocenter

Implementation Reference

  • The main execution logic for the 'scale_geometry' tool. Parses WKT input, applies shapely.affinity.scale with xfact, yfact, and origin parameters, returns scaled geometry as WKT.
    @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)}")
  • Resource endpoint listing available transformation tools, including 'scale_geometry'.
    @gis_mcp.resource("gis://operations/transformations")
    def get_transformations() -> Dict[str, List[str]]:
        """List available geometric transformations."""
        return {
            "operations": [
                "rotate_geometry",
                "scale_geometry",
                "translate_geometry"
            ]
        }
  • Function signature defining input schema (geometry: str WKT, xfact/yfact: float scaling factors, origin: str='center') and output (Dict with status, geometry WKT, message).
    def scale_geometry(geometry: str, xfact: float, yfact: float, 
                    origin: str = "center") -> Dict[str, Any]:

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mahdin75/gis-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server