← All procedures

geo.lengthNearLines

This function gives the length of the parts of a line that are within a distance of other lines. For example, the length of the edge of a parcel along a road (its frontage), or the length of a path along a river.

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

From the command line

$ mark geo lengthNearLines --line <any[][]> --others <any[][][]> --withinMeters <number>

As data, in a program

{
  "$proc": ["geo", "lengthNearLines"],
  "input": { "line": [], "others": [], "withinMeters": 1 }
}

Input

FieldTypeRequiredDefaultDescription
lineany[][]yesThe positions of the line, two or more.
othersany[][][]yesThe other lines. Each line has two or more positions. An empty list gives 0.
withinMetersnumberyesThe distance, 0 or more.
optionsobjectnoThe plane of the measures.

Output

FieldTypeRequiredDefaultDescription
metersnumberyesThe sum of the lengths of `parts`.
lengthMetersnumberyesThe length of the line.
partsobject[]yesThe parts of the line within the distance of a line, in the order along the line. Two parts do not touch.
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."
      },
      "others": {
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "array",
            "items": [
              {
                "type": "number"
              },
              {
                "type": "number"
              },
              {
                "type": "number"
              }
            ],
            "additionalItems": {},
            "minItems": 2
          }
        },
        "description": "The other lines. Each line has two or more positions. An empty list gives 0."
      },
      "withinMeters": {
        "type": "number",
        "description": "The distance, 0 or more."
      },
      "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",
      "others",
      "withinMeters"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "meters": {
        "type": "number",
        "description": "The sum of the lengths of `parts`."
      },
      "lengthMeters": {
        "type": "number",
        "description": "The length of the line."
      },
      "parts": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "fromMeters": {
              "type": "number"
            },
            "toMeters": {
              "type": "number"
            }
          },
          "required": [
            "fromMeters",
            "toMeters"
          ],
          "additionalProperties": {}
        },
        "description": "The parts of the line within the distance of a line, in the order along the line. Two parts do not touch."
      }
    },
    "required": [
      "meters",
      "lengthMeters",
      "parts"
    ],
    "additionalProperties": {}
  }
}