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

geokit

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geokit

An assortment of geolocation related tools, all packaged in one easy to use kit.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
decreased by-30.97%
Maintainers
1
Weekly downloads
 
Created
Source

geokit

npm npm bundle size Lint and Test Coveralls github David GitHub stars GitHub forks

Full documentation is available at https://geokit.geofirestore.com.

An assortment of geolocation related tools, all packaged in one easy to use kit.

Methods

distance(start: LatLngLiteral, end: LatLngLiteral, unit?: string): number

Calculates the distance, in kilometers, between two coordinates.

start and end must be LatLngLiterals { lat: 0, lng: 0 }.

import * as geokit from 'geokit';

const start = {lat: 41.3083, lng: -72.9279};
const end = {lat: -33.8688, lng: 151.2093};

const distance = geokit.distance(location1, location2); // distance === 16082.811206563834

hash(coordinates: LatLngLiteral, precision?: number): string

Generates Geohash of coordinates.

coordinates must be LatLngLiterals { lat: 0, lng: 0 }.

import * as geokit from 'geokit';

const coordinates = {lat: 41.3083,  lng: -72.9279};

const hash = geokit.hash(coordinates); // hash === 'drk4urzw2c'

decodeHash(hash: string): LatLngLiteral

Decodes a Geohash into its Latitude and Longitude as a LatLngLiteral.

import * as geokit from 'geokit';

const hash = 'r3gx2f77b';

const coordinates = geokit.decodeHash(hash); // coordinates === {lat: -33.86881113052368,  lng: 151.2093186378479}

validateCoordinates(coordinates: LatLngLiteral): boolean

Validates coordinates and returns a boolean if valid, or throws an error if invalid.

coordinates must be LatLngLiterals { lat: 0, lng: 0 }.

import * as geokit from 'geokit';

const coordinates = {lat: 41.3083,  lng: -72.9279};

const isValid = geokit.validateCoordinates(coordinates); // true

validateHash(hash: string): LatLngLiteral

Validates a Geohash and returns a boolean if valid, or throws an error if invalid.

import * as geokit from 'geokit';

const hash = 'r3gx2f77b';

const isValid = geokit.validateHash(hash); // true

Keywords

FAQs

Package last updated on 22 Jun 2020

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