geo.simplifyLines
This function simplifies lines, for example the roads of a map at a small scale, with the method of Douglas and Peucker. It gives one line for each line of the input, in the same direction. Each position of the result is a position of the input.
CLI- Package
- @procedures/geo · README
- Path
["geo","simplifyLines"]- CLI
mark geo simplifyLines --lines <any[][][]> --toleranceKm <number>- As data
{"$proc":["geo","simplifyLines"],"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","simplifyLines"], { lines: [], toleranceKm: 1 });
console.log(JSON.stringify(result));From the command line
$ mark geo simplifyLines --lines <any[][][]> --toleranceKm <number>
As data, in a program
{
"$proc": ["geo", "simplifyLines"],
"input": { "lines": [], "toleranceKm": 1 }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
lines | any[][][] | yes | The lines: each one is a list of two or more positions. | |
toleranceKm | number | yes | The largest distance in kilometres from a removed position to the result, 0 or more. | |
radiusKm | number | no | The radius of the sphere, more than 0. The default is `EARTH_MEAN_RADIUS_KM`. |
Output
The schema does not list fields (any[][][]).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"lines": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "array",
"items": [
{
"type": "number"
},
{
"type": "number"
},
{
"type": "number"
}
],
"additionalItems": {},
"minItems": 2
}
},
"description": "The lines: each one is a list of two or more positions."
},
"toleranceKm": {
"type": "number",
"description": "The largest distance in kilometres from a removed position to the result, 0 or more."
},
"radiusKm": {
"type": "number",
"description": "The radius of the sphere, more than 0. The default is `EARTH_MEAN_RADIUS_KM`."
}
},
"required": [
"lines",
"toleranceKm"
],
"additionalProperties": false
},
"output": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "array",
"items": [
{
"type": "number"
},
{
"type": "number"
},
{
"type": "number"
}
],
"additionalItems": {},
"minItems": 2
}
}
}
}