← All procedures

geo.geohash

Give the geohash of a point and the cell of that geohash, without the network

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

From the command line

$ mark geo geohash --point <object>

As data, in a program

{ "$proc": ["geo", "geohash"], "input": { "point": {} } }

Input

FieldTypeRequiredDefaultDescription
pointobjectyesThe point (degrees)
precisionintegerno7The number of characters, from 1 to 12 (default: 7)

Output

FieldTypeRequiredDefaultDescription
hashstringyesThe geohash
cellobjectyesThe cell of the geohash: its edges and its center (degrees)
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "point": {
        "type": "object",
        "properties": {
          "lat": {
            "type": "number",
            "minimum": -90,
            "maximum": 90
          },
          "lon": {
            "type": "number",
            "minimum": -180,
            "maximum": 180
          }
        },
        "required": [
          "lat",
          "lon"
        ],
        "description": "The point (degrees)"
      },
      "precision": {
        "default": 7,
        "description": "The number of characters, from 1 to 12 (default: 7)",
        "type": "integer",
        "minimum": 1,
        "maximum": 12
      }
    },
    "required": [
      "point"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "hash": {
        "type": "string",
        "description": "The geohash"
      },
      "cell": {
        "type": "object",
        "properties": {
          "south": {
            "type": "number"
          },
          "west": {
            "type": "number"
          },
          "north": {
            "type": "number"
          },
          "east": {
            "type": "number"
          },
          "center": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lon"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "south",
          "west",
          "north",
          "east",
          "center"
        ],
        "additionalProperties": false,
        "description": "The cell of the geohash: its edges and its center (degrees)"
      }
    },
    "required": [
      "hash",
      "cell"
    ],
    "additionalProperties": false
  }
}