← All procedures

geo.polygonIntersectsBBox

This function gives `true` when a closed polygon and a closed box have a common point. A box that crosses the antimeridian is two rectangles, one on each side.

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

From the command line

$ mark geo polygonIntersectsBBox --polygon <object | object> --box <object>

As data, in a program

{
  "$proc": ["geo", "polygonIntersectsBBox"],
  "input": { "polygon": "<polygon>", "box": {} }
}

Input

FieldTypeRequiredDefaultDescription
polygonobject | objectyes
boxobjectyes

Output

The schema does not list fields (boolean).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "polygon": {
        "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": {}
          }
        ]
      },
      "box": {
        "type": "object",
        "properties": {
          "west": {
            "type": "number"
          },
          "south": {
            "type": "number"
          },
          "east": {
            "type": "number"
          },
          "north": {
            "type": "number"
          }
        },
        "required": [
          "west",
          "south",
          "east",
          "north"
        ],
        "additionalProperties": {}
      }
    },
    "required": [
      "polygon",
      "box"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "boolean"
  }
}