← All procedures

geo.fromUnitVector

This function gives the point in the direction of a vector from the center of a sphere. The vector can have each length other than 0. The longitude of the result is normalized.

CLI
Package
@procedures/geo · README
Path
["geo","fromUnitVector"]
CLI
mark geo fromUnitVector --vector <object>
As data
{"$proc":["geo","fromUnitVector"],"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","fromUnitVector"], { vector: {} });
console.log(JSON.stringify(result));

From the command line

$ mark geo fromUnitVector --vector <object>

As data, in a program

{ "$proc": ["geo", "fromUnitVector"], "input": { "vector": {} } }

Input

FieldTypeRequiredDefaultDescription
vectorobjectyes

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": {
      "vector": {
        "type": "object",
        "properties": {
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "z": {
            "type": "number"
          }
        },
        "required": [
          "x",
          "y",
          "z"
        ],
        "additionalProperties": {}
      }
    },
    "required": [
      "vector"
    ],
    "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": {}
  }
}