Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/latlon-geohash

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/latlon-geohash

TypeScript definitions for latlon-geohash

  • 2.0.4
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.1K
increased by6.94%
Maintainers
0
Weekly downloads
 
Created
Source

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

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.

FAQs

Package last updated on 07 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc