geo.rewind
This function gives a copy of the polygon that follows the right-hand rule of RFC 7946. It reverses each clockwise exterior ring and each counterclockwise hole. It does not change a degenerate ring. The copy keeps the other members of the object.
CLI- Package
- @procedures/geo · README
- Path
["geo","rewind"]- CLI
mark geo rewind --polygon <object | object>- As data
{"$proc":["geo","rewind"],"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","rewind"], { polygon: "<polygon>" });
console.log(JSON.stringify(result));From the command line
$ mark geo rewind --polygon <object | object>
As data, in a program
{ "$proc": ["geo", "rewind"], "input": { "polygon": "<polygon>" } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
polygon | object | object | yes |
Output
The schema does not list fields (object | object).
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": {}
}
]
}
},
"required": [
"polygon"
],
"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": {}
}
]
}
}