← All procedures

geo.gridRegion

This function gives the region of a grid where each value is at `level` or more. The module documentation gives the rules. A region with no point gives an empty `MultiPolygon`.

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

From the command line

$ mark geo gridRegion --grid <object> --level <number>

As data, in a program

{ "$proc": ["geo", "gridRegion"], "input": { "grid": {}, "level": 1 } }

Input

FieldTypeRequiredDefaultDescription
gridobjectyesThe grid of values.
levelnumberyesThe level, a finite number.
optionsobjectnoThe tolerance of the simplification.

Output

The schema does not list fields (object | object).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "grid": {
        "type": "object",
        "properties": {
          "x": {
            "type": "object",
            "properties": {
              "start": {
                "type": "number"
              },
              "stop": {
                "type": "number"
              },
              "num": {
                "type": "number",
                "description": "The count of the values, an integer of 2 or more."
              }
            },
            "required": [
              "start",
              "stop",
              "num"
            ],
            "additionalProperties": {},
            "description": "The longitudes of the columns, from -180 to 180. The start can be more than the stop."
          },
          "y": {
            "type": "object",
            "properties": {
              "start": {
                "type": "number"
              },
              "stop": {
                "type": "number"
              },
              "num": {
                "type": "number",
                "description": "The count of the values, an integer of 2 or more."
              }
            },
            "required": [
              "start",
              "stop",
              "num"
            ],
            "additionalProperties": {},
            "description": "The latitudes of the rows, from -90 to 90. The start can be more than the stop."
          },
          "values": {
            "type": "object",
            "properties": {
              "length": {
                "type": "number"
              }
            },
            "required": [
              "length"
            ],
            "additionalProperties": {},
            "description": "The values, row by row: the value of the column `i` and the row `j` is `values[j * x.num + i]`. This is the order of the axis names `[\"y\", \"x\"]` of CoverageJSON. `NaN` or `null` is no value."
          }
        },
        "required": [
          "x",
          "y",
          "values"
        ],
        "additionalProperties": {},
        "description": "The grid of values."
      },
      "level": {
        "type": "number",
        "description": "The level, a finite number."
      },
      "options": {
        "type": "object",
        "properties": {
          "toleranceKm": {
            "type": "number",
            "description": "The tolerance of the simplification, in kilometres, 0 or more. The default is 0: the rings keep each position. The simplification keeps each position on the edge of the grid."
          },
          "radiusKm": {
            "type": "number",
            "description": "The radius of the sphere for the simplification, more than 0. The default is `EARTH_MEAN_RADIUS_KM`."
          }
        },
        "additionalProperties": {},
        "description": "The tolerance of the simplification."
      }
    },
    "required": [
      "grid",
      "level"
    ],
    "additionalProperties": false
  },
  "output": {
    "anyOf": [
      {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "Polygon"
          },
          "coordinates": {
            "type": "array",
            "items": {
              "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": {}
      },
      {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "MultiPolygon"
          },
          "coordinates": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "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": {}
      }
    ]
  }
}