← All procedures

geo.circleKm

This function gives a circle on the Earth as a polygon. The radius is a great-circle distance in kilometres. The module documentation gives the rules for the antimeridian and the poles.

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

From the command line

$ mark geo circleKm --center <object> --distance <number>

As data, in a program

{
  "$proc": ["geo", "circleKm"],
  "input": { "center": {}, "distance": 1 }
}

Input

FieldTypeRequiredDefaultDescription
centerobjectyes
distancenumberyesThe radius of the circle in kilometres, more than 0.
optionsobjectno
radiusKmnumbernoThe radius of the sphere, more than 0. The default is `EARTH_MEAN_RADIUS_KM`.

Output

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

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "center": {
        "type": "object",
        "properties": {
          "lat": {
            "type": "number",
            "description": "The latitude in degrees, from -90 to 90."
          },
          "lon": {
            "type": "number",
            "description": "The longitude in degrees. A normalized longitude is from -180 to less than 180."
          }
        },
        "required": [
          "lat",
          "lon"
        ],
        "additionalProperties": {}
      },
      "distance": {
        "type": "number",
        "description": "The radius of the circle in kilometres, more than 0."
      },
      "options": {
        "type": "object",
        "properties": {
          "vertices": {
            "type": "number",
            "description": "The number of the vertices on the circle, an integer from 3 to `MAX_CIRCLE_VERTICES`. The default is `DEFAULT_CIRCLE_VERTICES`. More vertices give a polygon nearer to the circle."
          }
        },
        "additionalProperties": {}
      },
      "radiusKm": {
        "type": "number",
        "description": "The radius of the sphere, more than 0. The default is `EARTH_MEAN_RADIUS_KM`."
      }
    },
    "required": [
      "center",
      "distance"
    ],
    "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": {}
      }
    ]
  }
}