Skip to main content
Glama

buffer

Create a buffer zone around geographic features to analyze proximity, define boundaries, or calculate spatial relationships in GIS workflows.

Instructions

Create a buffer around a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes
distanceYes
resolutionNo
join_styleNo
mitre_limitNo
single_sidedNo

Implementation Reference

  • The handler function for the 'buffer' MCP tool. It takes WKT geometry string, distance, and buffer parameters, uses Shapely to create a buffer, and returns the resulting WKT geometry in a success dict or raises error.
    @gis_mcp.tool()
    def buffer(geometry: str, distance: float, resolution: int = 16, 
            join_style: int = 1, mitre_limit: float = 5.0, 
            single_sided: bool = False) -> Dict[str, Any]:
        """Create a buffer around a geometry."""
        try:
            from shapely import wkt
            geom = wkt.loads(geometry)
            buffered = geom.buffer(
                distance=distance,
                resolution=resolution,
                join_style=join_style,
                mitre_limit=mitre_limit,
                single_sided=single_sided
            )
            return {
                "status": "success",
                "geometry": buffered.wkt,
                "message": "Buffer created successfully"
            }
        except Exception as e:
            logger.error(f"Error creating buffer: {str(e)}")
            raise ValueError(f"Failed to create buffer: {str(e)}")
  • Function signature providing input schema via type hints (geometry: str WKT, distance: float, etc.) and output as Dict[str, Any], with docstring description.
    def buffer(geometry: str, distance: float, resolution: int = 16, 
            join_style: int = 1, mitre_limit: float = 5.0, 
            single_sided: bool = False) -> Dict[str, Any]:
  • The @gis_mcp.tool() decorator registers this function as the MCP tool named 'buffer'.
    @gis_mcp.tool()

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