@squawk
    Preparing search index...

    Function routeToLineString

    • Builds a GeoJSON LineString from a parsed flight plan route, ready to render as a polyline on a map (e.g. MapLibre, Leaflet).

      Coordinates follow the GeoJSON [lon, lat] ordering. Returns undefined when the route yields fewer than two drawable points, since a LineString requires at least two positions to be valid.

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

      const resolver = createFlightplanResolver({ airports, navaids, fixes, airways });
      const route = resolver.parse('KJFK DCT MERIT J60 MARTN DCT KLAX');
      const line = routeToLineString(route);
      if (line) {
      map.addSource('route', { type: 'geojson', data: line });
      }

      Parameters

      Returns LineString | undefined

      A GeoJSON LineString, or undefined if fewer than two points.