# @types/latlon-geohash

> TypeScript definitions for latlon-geohash

Latest version **2.0.4** (published 2024-10-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/latlon-geohash
pnpm add @types/latlon-geohash
yarn add @types/latlon-geohash
bun add @types/latlon-geohash
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2024-10-07 |
| First published | 2017-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51445 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/latlon-geohash
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/latlon-geohash
- npm.io page: https://npm.io/package/@types/latlon-geohash

## Recent versions

- 2.0.4 (latest) — 2024-10-07
- 2.0.3 (ts4.5) — 2023-11-07
- 2.0.1 (ts4.3) — 2023-08-30
- 2.0.0 (ts3.8) — 2019-11-19
- 1.1.1 (ts2.4) — 2019-02-13
- 2.0.2 — 2023-10-18
- 1.1.0 — 2017-11-12

## README

# Installation
> `npm install --save @types/latlon-geohash`

# Summary
This package contains type definitions for latlon-geohash (https://github.com/chrisveness/latlon-geohash).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/latlon-geohash.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/latlon-geohash/index.d.ts)
````ts
declare namespace Geohash {
    type Direction =
        | "n"
        | "N"
        | "s"
        | "S"
        | "e"
        | "E"
        | "w"
        | "W";

    interface Neighbours {
        n: string;
        ne: string;
        e: string;
        se: string;
        s: string;
        sw: string;
        w: string;
        nw: string;
    }

    interface Bounds {
        sw: Point;
        ne: Point;
    }

    interface Point {
        lat: number;
        lon: number;
    }

    /**
     * Encodes latitude/longitude to geohash, either to specified precision or to automatically
     * evaluated precision.
     *
     * @param   lat - Latitude in degrees.
     * @param   lon - Longitude in degrees.
     * @param   [precision] - Number of characters in resulting geohash.
     * @returns Geohash of supplied latitude/longitude.
     * @throws  Invalid geohash.
     *
     * @example
     *     var geohash = Geohash.encode(52.205, 0.119, 7); // geohash: 'u120fxw'
     */
    function encode(
        latitude: number,
        longitude: number,
        precision?: number,
    ): string;

    /**
     * Decode geohash to latitude/longitude (location is approximate centre of geohash cell,
     *     to reasonable precision).
     *
     * @param   geohash - Geohash string to be converted to latitude/longitude.
     * @returns (Center of) geohashed location.
     * @throws  Invalid geohash.
     *
     * @example
     *     var latlon = Geohash.decode('u120fxw'); // latlon: { lat: 52.205, lon: 0.1188 }
     */
    function decode(geohash: string): Point;

    /**
     * Returns SW/NE latitude/longitude bounds of specified geohash.
     *
     * @param   geohash - Cell that bounds are required of.
     * @returns The Bounds
     * @throws  Invalid geohash.
     */
    function bounds(geohash: string): Bounds;

    /**
     * Determines adjacent cell in given direction.
     *
     * @param   geohash - Cell to which adjacent cell is required.
     * @param   direction - Direction from geohash (N/S/E/W).
     * @returns Geocode of adjacent cell.
     * @throws  Invalid geohash.
     */
    function adjacent(geohash: string, direction: Direction): string;

    /**
     * Returns all 8 adjacent cells to specified geohash.
     *
     * @param   geohash - Geohash neighbours are required of.
     * @returns The neighbours
     * @throws  Invalid geohash.
     */
    function neighbours(geohash: string): Neighbours;
}

export default Geohash;

````

### Additional Details
 * Last updated: Mon, 07 Oct 2024 22:07:58 GMT
 * Dependencies: none

# Credits
These definitions were written by [Robert Imig](https://github.com/rimig).

---
_Source: https://npm.io/package/@types/latlon-geohash · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
