← All procedures

geo.routeLine

This function gives the GeoJSON line of a route, from the lines of its edges, and its length.

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

From the command line

$ mark geo routeLine --graph <object> --edges <number[]>

As data, in a program

{ "$proc": ["geo", "routeLine"], "input": { "graph": {}, "edges": [] } }

Input

FieldTypeRequiredDefaultDescription
graphobjectyes
edgesnumber[]yes

Output

FieldTypeRequiredDefaultDescription
lineobjectyes
metersnumberyesThe sum of the `meters` of the edges.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "graph": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string"
          },
          "nodes": {
            "type": "array",
            "items": {
              "type": "array",
              "items": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "point": {
                      "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": {}
                    }
                  },
                  "required": [
                    "id",
                    "point"
                  ],
                  "additionalProperties": {}
                }
              ],
              "additionalItems": {},
              "minItems": 2,
              "maxItems": 2
            },
            "x-procedures-codec": "map"
          },
          "edges": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "from": {
                  "type": "string"
                },
                "to": {
                  "type": "string"
                },
                "weight": {
                  "type": "number"
                },
                "meters": {
                  "type": "number",
                  "description": "The length of `line` on the sphere, from `distanceMeters`."
                },
                "line": {
                  "type": "array",
                  "items": {
                    "type": "array",
                    "items": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "additionalItems": {},
                    "minItems": 2
                  },
                  "description": "The positions from the node `from` to the node `to`."
                },
                "feature": {
                  "type": "number",
                  "description": "The index of the feature of the way in the input."
                },
                "segment": {
                  "type": "number",
                  "description": "The number of the part of the way. The two directions of one part have the same number."
                }
              },
              "required": [
                "from",
                "to",
                "weight",
                "meters",
                "line",
                "feature",
                "segment"
              ],
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "mode",
          "nodes",
          "edges"
        ],
        "additionalProperties": {}
      },
      "edges": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    },
    "required": [
      "graph",
      "edges"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "line": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "LineString"
          },
          "coordinates": {
            "type": "array",
            "items": {
              "type": "array",
              "items": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "additionalItems": {},
              "minItems": 2
            }
          },
          "bbox": {
            "anyOf": [
              {
                "type": "array",
                "items": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  }
                ],
                "additionalItems": {},
                "minItems": 4,
                "maxItems": 4
              },
              {
                "type": "array",
                "items": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "number"
                  }
                ],
                "additionalItems": {},
                "minItems": 6,
                "maxItems": 6
              }
            ],
            "description": "The bounding box of the object (RFC 7946, section 5)."
          }
        },
        "required": [
          "type",
          "coordinates"
        ],
        "additionalProperties": {}
      },
      "meters": {
        "type": "number",
        "description": "The sum of the `meters` of the edges."
      }
    },
    "required": [
      "line",
      "meters"
    ],
    "additionalProperties": {}
  }
}