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

common-geohash-parent

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

common-geohash-parent

Functions to get common geohash parent(s) of coordinates or bbox

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35
decreased by-49.28%
Maintainers
1
Weekly downloads
 
Created
Source

Common geohash parent finder v0.1.0

Class with multiple methods to help you find the common parent geohash from points, geohashes, bounding boxes, polygons or other GeoJSON shapes.

Installation

Using npm:

npm i common-geohash-parent

Using yarn:

yarn add common-geohash-parent

Example usage

In node:

const ParentFinder = require('common-geohash-parent');

const bbox = [-3.944092, 40.241799, -3.261566, 40.779502];
const precision = 5;
const finder = new ParentFinder(precision);
finder.fromBBox(bbox)
  .then((parents) => {
    // parents is ['ezjp','ezjr','ezjx','ezjn','ezjq','ezjw','ezjj','ezjm','ezjt','ezjh','ezjk','ezjs']
    ...
  });

Classes

ParentFinder

Typedefs

ParentGeohashList : Array.<string>
OptimizationOptions

ParentFinder

Kind: global class

new ParentFinder()

ParentFinder class

parentFinder.fromPoints(points) ⇒ ParentGeohashList

Finds common parents from array of points

Kind: instance method of ParentFinder
Returns: ParentGeohashList - Array of geohashes

ParamTypeDescription
pointsArray.<Array.<number>>[lon, lat]

parentFinder.fromGeohashes(hashes) ⇒ ParentGeohashList

Finds common parents from array of geohashes

Kind: instance method of ParentFinder
Returns: ParentGeohashList - List of parent geohashes

ParamTypeDescription
hashesArray.<string>List of geohashes

parentFinder.fromBBox(bbox) ⇒ Promise.<ParentGeohashList>

Finds common parents from bounding box

Kind: instance method of ParentFinder
Returns: Promise.<ParentGeohashList> - Promise of list of parent geohashes

ParamTypeDescription
bboxArray.<number>[number, number, number, number]

parentFinder.fromPolygon(inputPolygon) ⇒ Promise.<ParentGeohashList>

Finds common parents from polygon feature

Kind: instance method of ParentFinder
Returns: Promise.<ParentGeohashList> - Promise of list of parent geohashes

ParamTypeDescription
inputPolygonobjectGeoJSON shape

ParentFinder.ParentFinder

Kind: static class of ParentFinder

new ParentFinder(parentPrecision, [optimization])

Creates an instance of ParentFinder.

ParamTypeDescription
parentPrecisionnumberInitial parent precision
[optimization]OptimizationOptionsIf desired, specify optimization options

ParentGeohashList : Array.<string>

Kind: global typedef

OptimizationOptions

Kind: global typedef
Properties

NameType
enabledboolean
maxParentsnumber

Keywords

FAQs

Package last updated on 28 Apr 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