← All procedures

geo.commonAreaSquareMeters

This function gives the area of the part that all the Polygons and MultiPolygons have in common, on an ellipsoid, in square metres. An edge is a straight line in longitude and latitude, as RFC 7946 tells. The polygons can cross the antimeridian: a polygon moved by 360 degrees is the same area of the Earth. For one polygon, the result is its area.

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

From the command line

$ mark geo commonAreaSquareMeters --polygons <object | object[]>

As data, in a program

{
  "$proc": ["geo", "commonAreaSquareMeters"],
  "input": { "polygons": [] }
}

Input

FieldTypeRequiredDefaultDescription
polygonsobject | object[]yesThe polygons. The holes of a polygon must be inside its exterior, and the polygons of a MultiPolygon must not overlap.
ellipsoidobjectnoThe ellipsoid. The default is `WGS84`.

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "polygons": {
        "type": "array",
        "items": {
          "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": {}
            }
          ]
        },
        "description": "The polygons. The holes of a polygon must be inside its exterior, and the polygons of a\nMultiPolygon must not overlap."
      },
      "ellipsoid": {
        "type": "object",
        "properties": {
          "equatorialRadiusMeters": {
            "type": "number",
            "description": "The equatorial radius `a` in metres. It is a finite number more than 0."
          },
          "flattening": {
            "type": "number",
            "description": "The flattening `f`, equal to `(a - b) / a` for the polar radius `b`. It is a finite number less than 1. A negative flattening gives a prolate ellipsoid. The results are accurate for an absolute flattening of 1/50 or less."
          }
        },
        "required": [
          "equatorialRadiusMeters",
          "flattening"
        ],
        "additionalProperties": {},
        "description": "The ellipsoid. The default is `WGS84`."
      }
    },
    "required": [
      "polygons"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}