GithubHelp home page GithubHelp logo

alrico88 / common-geohash-parent Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 80 KB

Compendium of methods to find common geohash parents from points, geohashes, polygons or other GeoJSON features

Home Page: https://www.npmjs.com/package/common-geohash-parent

JavaScript 100.00%
geohash parent polygon feature node

common-geohash-parent's Introduction

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

Param Type Description
points Array.<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

Param Type Description
hashes Array.<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

Param Type Description
bbox Array.<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

Param Type Description
inputPolygon object GeoJSON shape

ParentFinder.ParentFinder

Kind: static class of ParentFinder

new ParentFinder(parentPrecision, [optimization])

Creates an instance of ParentFinder.

Param Type Description
parentPrecision number Initial parent precision
[optimization] OptimizationOptions If desired, specify optimization options

ParentGeohashList : Array.<string>

Kind: global typedef

OptimizationOptions

Kind: global typedef
Properties

Name Type
enabled boolean
maxParents number

common-geohash-parent's People

Contributors

alrico88 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.