← All procedures

geo.pointAlongLine

This function gives the point at a distance along a line, moved by an offset to the left or to the right. For many points on one line, use `lineReference`. Its rules apply.

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

From the command line

$ mark geo pointAlongLine --line <any[][]> --alongMeters <number>

As data, in a program

{
  "$proc": ["geo", "pointAlongLine"],
  "input": { "line": [], "alongMeters": 1 }
}

Input

FieldTypeRequiredDefaultDescription
lineany[][]yesThe positions of the line, two or more.
alongMetersnumberyesThe distance from the first position. A value out of the range from 0 to the length gives an end.
offsetMetersnumbernoThe offset to the left. A negative value goes to the right. The default is 0.
optionsobjectnoThe plane of the measures.

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": {
      "line": {
        "type": "array",
        "items": {
          "type": "array",
          "items": [
            {
              "type": "number"
            },
            {
              "type": "number"
            },
            {
              "type": "number"
            }
          ],
          "additionalItems": {},
          "minItems": 2
        },
        "description": "The positions of the line, two or more."
      },
      "alongMeters": {
        "type": "number",
        "description": "The distance from the first position. A value out of the range from 0 to the length gives an end."
      },
      "offsetMeters": {
        "type": "number",
        "description": "The offset to the left. A negative value goes to the right. The default is 0."
      },
      "options": {
        "type": "object",
        "properties": {
          "projection": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "The name of the projection, for the legend of a map."
              },
              "toPlane": {
                "type": "object",
                "properties": {
                  "$proc": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "input": {},
                  "$when": {
                    "type": "string",
                    "const": "$never"
                  }
                },
                "required": [
                  "$proc"
                ],
                "additionalProperties": {},
                "x-procedures-program": {
                  "params": [
                    "point"
                  ],
                  "inputs": [
                    {
                      "$ref": "#/$defs/LatLon"
                    }
                  ],
                  "output": {
                    "$ref": "#/$defs/PlanePoint"
                  }
                },
                "description": "This function gives the point on the plane for a point on the Earth."
              },
              "fromPlane": {
                "type": "object",
                "properties": {
                  "$proc": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "input": {},
                  "$when": {
                    "type": "string",
                    "const": "$never"
                  }
                },
                "required": [
                  "$proc"
                ],
                "additionalProperties": {},
                "x-procedures-program": {
                  "params": [
                    "point"
                  ],
                  "inputs": [
                    {
                      "$ref": "#/$defs/PlanePoint"
                    }
                  ],
                  "output": {
                    "$ref": "#/$defs/LatLon"
                  }
                },
                "description": "This function gives the point on the Earth for a point on the plane. The longitude of the result is normalized."
              },
              "scale": {
                "type": "object",
                "properties": {
                  "$proc": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "input": {},
                  "$when": {
                    "type": "string",
                    "const": "$never"
                  }
                },
                "required": [
                  "$proc"
                ],
                "additionalProperties": {},
                "x-procedures-program": {
                  "params": [
                    "point"
                  ],
                  "inputs": [
                    {
                      "$ref": "#/$defs/LatLon"
                    }
                  ],
                  "output": {
                    "$ref": "#/$defs/ProjectionScale"
                  }
                },
                "description": "This function gives the scale factors of the projection at a point on the Earth."
              }
            },
            "required": [
              "name",
              "toPlane",
              "fromPlane",
              "scale"
            ],
            "additionalProperties": {},
            "description": "The plane of the measures. The default is `azimuthalEquidistant` with the center at the first position of the line. Each length is in the metres of this plane."
          }
        },
        "additionalProperties": {},
        "description": "The plane of the measures."
      }
    },
    "required": [
      "line",
      "alongMeters"
    ],
    "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": {}
  }
}