@squawk
    Preparing search index...

    Function computeRouteDistance

    • Computes the total great-circle route distance and optional estimated time enroute for a parsed flight plan route.

      Extracts the ordered sequence of geographic points from the route elements, sums leg distances, and divides by the given ground speed for ETE.

      Elements without coordinates (DCT, speed/altitude groups) are silently skipped. Unresolved tokens are collected in unresolvedElements to indicate which parts of the route could not contribute to the distance calculation.

      Airway segments use the FAA-published segment distance where the source publishes a positive one and the airway element says which direction it is flown in, falling back to great-circle computation otherwise. A leg that spans a published gap in its airway is still measured as a straight line and counted, but is flagged with crossesGap, a leg on an airway segment the FAA marks unusable is flagged with unusable, and a leg along or into a procedure filed at an airport it does not serve is flagged with procedureAirportMismatch, so the caller can see that the route is not valid as filed.

      import { createFlightplanResolver, computeRouteDistance } from '@squawk/flightplan';

      const resolver = createFlightplanResolver({ airports, navaids, fixes, airways });
      const route = resolver.parse('KSEA DCT SEA J70 GEP DCT KJFK');
      const result = computeRouteDistance(route, 450);
      console.log(result.totalDistanceNm, result.estimatedTimeEnrouteHrs);

      Parameters

      Returns RouteDistanceResult

      Route distance breakdown with optional ETE.