← All procedures

geo.destinationKm

This function gives the point at a distance from a start point, along the great circle with an initial bearing. The longitude of the result is normalized. A negative distance goes in the opposite direction.

CLI
Package
@procedures/geo · README
Path
["geo","destinationKm"]
CLI
mark geo destinationKm --from <object> --bearingDegrees <number> --distance <number>
As data
{"$proc":["geo","destinationKm"],"input":{}}

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","destinationKm"], { from: {}, bearingDegrees: 1, distance: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark geo destinationKm --from <object> --bearingDegrees <number> --distance <number>

As data, in a program

{
  "$proc": ["geo", "destinationKm"],
  "input": { "from": {}, "bearingDegrees": 1, "distance": 1 }
}

Input

FieldTypeRequiredDefaultDescription
fromobjectyes
bearingDegreesnumberyesThe initial bearing in degrees clockwise from north.
distancenumberyesThe distance in kilometres.
radiusKmnumbernoThe radius of the sphere, more than 0. The default is `EARTH_MEAN_RADIUS_KM`.

Output

FieldTypeRequiredDefaultDescription
latnumberyesThe latitude in degrees, from -90 to 90.
lonnumberyesThe longitude in degrees. A normalized longitude is from -180 to less than 180.
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": {}
      },
      "bearingDegrees": {
        "type": "number",
        "description": "The initial bearing in degrees clockwise from north."
      },
      "distance": {
        "type": "number",
        "description": "The distance in kilometres."
      },
      "radiusKm": {
        "type": "number",
        "description": "The radius of the sphere, more than 0. The default is `EARTH_MEAN_RADIUS_KM`."
      }
    },
    "required": [
      "from",
      "bearingDegrees",
      "distance"
    ],
    "additionalProperties": false
  },
  "output": {
    "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": {}
  }
}