← All procedures

geo.geohashNeighbor

This function gives the neighbor of a cell in a direction, with the same precision. The longitude wraps at the antimeridian. Past a pole, the result is `undefined`.

CLI
Package
@procedures/geo · README
Path
["geo","geohashNeighbor"]
CLI
mark geo geohashNeighbor --hash <string> --direction <"e" | "n" | "ne" | "nw" | "s" | "se" | "sw" | "w">
As data
{"$proc":["geo","geohashNeighbor"],"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","geohashNeighbor"], { hash: "<hash>", direction: "e" });
console.log(JSON.stringify(result));

From the command line

$ mark geo geohashNeighbor --hash <string> --direction <"e" | "n" | "ne" | "nw" | "s" | "se" | "sw" | "w">

As data, in a program

{
  "$proc": ["geo", "geohashNeighbor"],
  "input": { "hash": "<hash>", "direction": "e" }
}

Input

FieldTypeRequiredDefaultDescription
hashstringyes
direction"e" | "n" | "ne" | "nw" | "s" | "se" | "sw" | "w"yes

Output

The schema does not list fields (string | null).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "hash": {
        "type": "string"
      },
      "direction": {
        "type": "string",
        "enum": [
          "e",
          "n",
          "ne",
          "nw",
          "s",
          "se",
          "sw",
          "w"
        ]
      }
    },
    "required": [
      "hash",
      "direction"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": [
      "string",
      "null"
    ]
  }
}