Skip to main content
Glama

calculate_geodetic_distance

Measure the geodetic distance between two geographic points on Earth using WGS84 ellipsoid or a specified model. Ideal for precise geospatial analysis in GIS workflows.

Instructions

Calculate geodetic distance between points.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ellpsNoWGS84
point1Yes
point2Yes

Implementation Reference

  • The handler function for the 'calculate_geodetic_distance' tool. It uses pyproj.Geod to compute the inverse geodetic problem, returning distance and azimuths between two lat/lon points.
    @gis_mcp.tool() def calculate_geodetic_distance(point1: List[float], point2: List[float], ellps: str = "WGS84") -> Dict[str, Any]: """Calculate geodetic distance between points.""" try: import pyproj geod = pyproj.Geod(ellps=ellps) lon1, lat1 = point1 lon2, lat2 = point2 forward_azimuth, back_azimuth, distance = geod.inv(lon1, lat1, lon2, lat2) return { "status": "success", "distance": distance, "forward_azimuth": forward_azimuth, "back_azimuth": back_azimuth, "ellps": ellps, "message": "Geodetic distance calculated successfully" } except Exception as e: logger.error(f"Error calculating geodetic distance: {str(e)}") raise ValueError(f"Failed to calculate geodetic distance: {str(e)}")
  • Resource listing 'calculate_geodetic_distance' among geodetic operations, aiding in tool discovery.
    @gis_mcp.resource("gis://crs/geodetic") def get_geodetic_operations() -> Dict[str, List[str]]: """List available geodetic operations.""" return { "operations": [ "get_geod_info", "calculate_geodetic_distance", "calculate_geodetic_point", "calculate_geodetic_area" ] }

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