Skip to main content
Glama

intersection

Determine the overlapping area of two geometries using the GIS MCP Server, enabling precise geospatial analysis for accurate intersection identification.

Instructions

Find intersection of two geometries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometry1Yes
geometry2Yes

Implementation Reference

  • The primary handler for the 'intersection' MCP tool. Computes the geometric intersection of two input geometries (provided as WKT strings) using Shapely's intersection method and returns the result as WKT in a standardized response dictionary.
    @gis_mcp.tool() def intersection(geometry1: str, geometry2: str) -> Dict[str, Any]: """Find intersection of two geometries.""" try: from shapely import wkt geom1 = wkt.loads(geometry1) geom2 = wkt.loads(geometry2) result = geom1.intersection(geom2) return { "status": "success", "geometry": result.wkt, "message": "Intersection created successfully" } except Exception as e: logger.error(f"Error creating intersection: {str(e)}") raise ValueError(f"Failed to create intersection: {str(e)}")
  • Import statements in the main entry point that load the shapely_functions module, triggering the @gis_mcp.tool() decorator execution which registers the 'intersection' tool with the FastMCP server.
    from . import ( geopandas_functions, shapely_functions, rasterio_functions, pyproj_functions, pysal_functions, )
  • Resource endpoint listing 'intersection' as one of the available basic geometric operations, aiding tool discovery.
    @gis_mcp.resource("gis://operations/basic") def get_basic_operations() -> Dict[str, List[str]]: """List available basic geometric operations.""" return { "operations": [ "buffer", "intersection", "union", "difference", "symmetric_difference" ] }
  • src/gis_mcp/mcp.py:5-6 (registration)
    Initialization of the FastMCP server instance 'gis_mcp' used by decorators (@gis_mcp.tool() and @gis_mcp.resource()) to register tools and resources.
    gis_mcp = FastMCP("GIS MCP")

Other Tools

Related Tools

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