import type { GeoPoint } from "./types.ts"; /** * WGS84 equatorial radius, metres (NIMA TR8350.2). * * @example * ```ts * import { WGS84_A_M } from "@johnmorrisdotca/chikyu-earth"; * * console.log(WGS84_A_M); * ``` */ export declare const WGS84_A_M = 6378137; /** * WGS84 flattening (NIMA TR8350.2). * * @example * ```ts * import { WGS84_F } from "@johnmorrisdotca/chikyu-earth"; * * console.log(WGS84_F.toFixed(12)); * ``` */ export declare const WGS84_F: number; /** * Mean Earth radius, kilometres, the same sphere the city distances use. * * @example * ```ts * import { MEAN_RADIUS_KM } from "@johnmorrisdotca/chikyu-earth"; * * console.log(MEAN_RADIUS_KM); * ``` */ export declare const MEAN_RADIUS_KM = 6371.0088; /** * The speed a flight-time estimate assumes, in kilometres an hour: a jet's cruise, with no wind, climb or holding. * * @example * ```ts * import { FLIGHT_SPEED_KM_H } from "@johnmorrisdotca/chikyu-earth"; * * console.log(FLIGHT_SPEED_KM_H); * ``` */ export declare const FLIGHT_SPEED_KM_H = 900; /** * The distance and the bearings between two places. * * @example * ```ts * import type { RouteLeg } from "@johnmorrisdotca/chikyu-earth"; * * const none: RouteLeg | null = null; * console.log(none); * ``` */ export interface RouteLeg { /** Geodesic distance on WGS84, kilometres. The great-circle distance when the geodesic did not converge. */ kilometres: number; /** Great-circle distance on a sphere of {@link MEAN_RADIUS_KM}, kilometres. */ greatCircleKm: number; /** Degrees clockwise from north, 0 to 360, at the start. */ initialBearing: number; /** Degrees clockwise from north, 0 to 360, at the end. */ finalBearing: number; /** Hours at {@link FLIGHT_SPEED_KM_H}. */ flightHours: number; /** The point halfway along the geodesic (or the great circle, when the geodesic did not converge). */ midpoint: GeoPoint; /** False when Vincenty's formula did not converge (nearly antipodal): the distance is then the great circle. */ exact: boolean; } /** * The great-circle distance, kilometres, on a sphere of {@link MEAN_RADIUS_KM}. The same angle `trackSteps` uses between two unit vectors. * * @param from - The start, degrees. * @param to - The end, degrees. * @returns The distance, or null when a place is not on the Earth. * * @example * ```ts * import { greatCircleKm } from "@johnmorrisdotca/chikyu-earth"; * * console.log(greatCircleKm({ lon: 0, lat: 0 }, { lon: 0, lat: 0 })); * ``` */ export declare function greatCircleKm(from: GeoPoint, to: GeoPoint): number | null; /** * Distance, bearings, midpoint and a flight-time estimate between two places. The distance quoted is the WGS84 geodesic. * The flight time is that distance at {@link FLIGHT_SPEED_KM_H}, an estimate with no wind. * * @param from - The start, degrees. * @param to - The end, degrees. * @returns The leg, or null when a place is not on the Earth. * * @example * ```ts * import { routeLeg } from "@johnmorrisdotca/chikyu-earth"; * * const leg = routeLeg({ lon: 0, lat: 0 }, { lon: 1, lat: 0 }); * console.log(leg?.kilometres.toFixed(3), leg?.initialBearing); * ``` */ export declare function routeLeg(from: GeoPoint, to: GeoPoint): RouteLeg | null; /** * Points along the geodesic from `from` to `to`, including both ends. `count` is how many (2 when they are the same place, 64 when left out). * When the geodesic does not converge, the points are the great circle (`trackSteps`). * * @param from - The start. * @param to - The end. * @param count - How many points, at least 2. * @returns The points, or an empty list when a place is not on the Earth. * * @example * ```ts * import { routePoints } from "@johnmorrisdotca/chikyu-earth"; * * console.log(routePoints({ lon: 0, lat: 0 }, { lon: 1, lat: 0 }, 3).length); * ``` */ export declare function routePoints(from: GeoPoint, to: GeoPoint, count?: number): GeoPoint[]; /** * The runs of a route after it is split at the date line, so a flat map draws two pieces instead of a line across the world. * A run that does not cross is one piece. Uses `splitDateLine`. * * @param points - Points in order along the route, including the ends. * @returns One list of points per piece. * * @example * ```ts * import { routeRuns } from "@johnmorrisdotca/chikyu-earth"; * * console.log(routeRuns([{ lon: 179, lat: 0 }, { lon: -179, lat: 0 }]).length); * ``` */ export declare function routeRuns(points: readonly GeoPoint[]): GeoPoint[][]; /** * Read the `route` attribute: `lon,lat,lon,lat`. Anything else is no route. * * @param value - The attribute's text, or null. * @returns The two places, or null. * * @example * ```ts * import { readRoute } from "@johnmorrisdotca/chikyu-earth"; * * console.log(readRoute("139.69,35.69,-0.13,51.51")?.from.lat); * console.log(readRoute("no")); * ``` */ export declare function readRoute(value: string | null | undefined): { from: GeoPoint; to: GeoPoint; } | null; /** * The `route` attribute for two places, four decimals. * * @param route - The two places. * @returns `lon,lat,lon,lat`. * * @example * ```ts * import { routeText } from "@johnmorrisdotca/chikyu-earth"; * * console.log(routeText({ from: { lon: 1, lat: 2 }, to: { lon: 3, lat: 4 } })); * ``` */ export declare function routeText(route: { from: GeoPoint; to: GeoPoint; }): string;