This function gives the geodesic between two points on an ellipsoid: its length and its bearings at the two ends. The geodesic is the shortest path between the two points on the ellipsoid.
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/geo/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["geo","geodesicInverse"], { from: {}, to: {} });
console.log(JSON.stringify(result));From the command line
$ mark geo geodesicInverse --from <object> --to <object>
As data, in a program
{
"$proc": ["geo", "geodesicInverse"],
"input": { "from": {}, "to": {} }
}JSON Schemas
{
"input": {
"type": "object",
"properties": {
"from": {
"type": "object",
"properties": {
"lat": {
"type": "number",
"description": "The latitude in degrees, from -90 to 90."
},
"lon": {
"type": "number",
"description": "The longitude in degrees. A normalized longitude is from -180 to less than 180."
}
},
"required": [
"lat",
"lon"
],
"additionalProperties": {},
"description": "The first point."
},
"to": {
"type": "object",
"properties": {
"lat": {
"type": "number",
"description": "The latitude in degrees, from -90 to 90."
},
"lon": {
"type": "number",
"description": "The longitude in degrees. A normalized longitude is from -180 to less than 180."
}
},
"required": [
"lat",
"lon"
],
"additionalProperties": {},
"description": "The second point."
},
"ellipsoid": {
"type": "object",
"properties": {
"equatorialRadiusMeters": {
"type": "number",
"description": "The equatorial radius `a` in metres. It is a finite number more than 0."
},
"flattening": {
"type": "number",
"description": "The flattening `f`, equal to `(a - b) / a` for the polar radius `b`. It is a finite number less than 1. A negative flattening gives a prolate ellipsoid. The results are accurate for an absolute flattening of 1/50 or less."
}
},
"required": [
"equatorialRadiusMeters",
"flattening"
],
"additionalProperties": {},
"description": "The ellipsoid. The default is `WGS84`."
}
},
"required": [
"from",
"to"
],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"meters": {
"type": "number",
"description": "The length of the geodesic in metres."
},
"initialBearing": {
"type": "number",
"description": "The bearing of the geodesic at the first point, in degrees clockwise from north, from 0 to less than 360."
},
"finalBearing": {
"type": "number",
"description": "The bearing of the geodesic at the second point, away from the first point, from 0 to less than 360."
}
},
"required": [
"meters",
"initialBearing",
"finalBearing"
],
"additionalProperties": {}
}
}