2.3.0 • Published 3 months ago

geohashes-between v2.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

geohashes-between

Get a list of geohashes between two geohashes, or between two coordinates.

Installation

Using npm, npm i geohashes-between.

Using yarn, yarn add geohashes-between.

Usage

Using import

import { getGeohashesBetweenTwoGeohashes } from 'geohashes-between';

In a CommonJS environment

const { getGeohashesBetweenTwoGeohashes } = require('geohashes-between');

Then:

const list = getGeohashesBetweenTwoGeohashes('ezep', 'ezex');
// list is ['ezer']

Or:

const pointA = [-3.684166, 40.416763];
const pointB = [-3.720741, 40.364335];

const list = getGeohashesBetweenCoordinates(pointA, pointB, 6);
// list is ['ezjmuj', 'ezjmuh','ezjmu5', 'ezjmgg','ezjmgf', 'ezjmgc','ezjmgb', 'ezjmg8','ezjmex', 'ezjmew','ezjmeq', 'ezjmem','ezjmek']

Table of contents

Functions

Functions

getBBoxRingGeohashes

getBBoxRingGeohashes(bbox, precision): string[]

Find the geohashes of a given precision that form a BBox ring

Parameters

NameTypeDescription
bboxBBoxThe BBox to find the ring geohashes
precisionnumberPrecision for the geohashes

Returns

string[]

Geohashes list


getGeohashesBetweenCoordinates

getGeohashesBetweenCoordinates(pointA, pointB, precision): string[]

Finds the geohashes of a given precision between two coordinates

export

Parameters

NameTypeDescription
pointAPositionStarting coordinate lon, lat
pointBPositionEnd coordinate lon, lat
precisionnumberDesired geohash precision

Returns

string[]

The list of geohashes between those coords


getGeohashesBetweenTwoGeohashes

getGeohashesBetweenTwoGeohashes(geohashStart, geohashEnd, includeStartEnd?): string[]

Gets a list of geohashes between a starting and end geohash Both geohashes should be of the same precision

export

Parameters

NameTypeDefault valueDescription
geohashStartstringundefinedThe starting geohash
geohashEndstringundefinedThe ending geohash
includeStartEndbooleanfalse-

Returns

string[]

The list of geohashes between start and end

2.3.0

3 months ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago