Skip to main content
Glama

triangulate_geometry

Create a triangulation of a geometry to enable accurate geospatial analysis and spatial measurements for GIS operations.

Instructions

Create a triangulation of a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes

Implementation Reference

  • The primary handler function for the 'triangulate_geometry' MCP tool. It accepts a WKT geometry string, uses Shapely's triangulate operation to generate triangles, and returns a dictionary with the resulting geometries in WKT format and a success message.
    @gis_mcp.tool()
    def triangulate_geometry(geometry: str) -> Dict[str, Any]:
        """Create a triangulation of a geometry."""
        try:
            from shapely import wkt
            from shapely.ops import triangulate
            geom = wkt.loads(geometry)
            triangles = triangulate(geom)
            return {
                "status": "success",
                "geometries": [tri.wkt for tri in triangles],
                "message": "Triangulation created successfully"
            }
        except Exception as e:
            logger.error(f"Error creating triangulation: {str(e)}")
            raise ValueError(f"Failed to create triangulation: {str(e)}")
  • A resource endpoint that lists 'triangulate_geometry' among available advanced GIS operations, serving as a catalog or indirect registration reference for the tool.
    @gis_mcp.resource("gis://operations/advanced")
    def get_advanced_operations() -> Dict[str, List[str]]:
        """List available advanced operations."""
        return {
            "operations": [
                "triangulate_geometry",
                "voronoi",
                "unary_union_geometries"
            ]
        }

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