https://github.com/alrico88/geohashes-between
Helper to get a list of geohashes between a start and end geohash, in a given direction
https://github.com/alrico88/geohashes-between
coordinates geohash geojson
Last synced: 6 months ago
JSON representation
Helper to get a list of geohashes between a start and end geohash, in a given direction
- Host: GitHub
- URL: https://github.com/alrico88/geohashes-between
- Owner: alrico88
- License: mit
- Created: 2021-06-12T11:59:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-22T16:16:46.000Z (over 1 year ago)
- Last Synced: 2025-04-19T00:51:24.949Z (6 months ago)
- Topics: coordinates, geohash, geojson
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/geohashes-between
- Size: 323 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`
```javascript
import { getGeohashesBetweenTwoGeohashes } from 'geohashes-between';
```In a CommonJS environment
```javascript
const { getGeohashesBetweenTwoGeohashes } = require('geohashes-between');
```Then:
```javascript
const list = getGeohashesBetweenTwoGeohashes('ezep', 'ezex');
// list is ['ezer']
```Or:
```javascript
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
- [getBBoxRingGeohashes](#getbboxringgeohashes)
- [getGeohashesBetweenCoordinates](#getgeohashesbetweencoordinates)
- [getGeohashesBetweenTwoGeohashes](#getgeohashesbetweentwogeohashes)## Functions
### getBBoxRingGeohashes
▸ **getBBoxRingGeohashes**(`bbox`, `precision`): `string`[]
Find the geohashes of a given precision that form a BBox ring
#### Parameters
| Name | Type | Description |
| :---------- | :------- | :---------------------------------- |
| `bbox` | `BBox` | The BBox to find the ring geohashes |
| `precision` | `number` | Precision 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
| Name | Type | Description |
| :---------- | :--------- | :----------------------------- |
| `pointA` | `Position` | Starting coordinate [lon, lat] |
| `pointB` | `Position` | End coordinate [lon, lat] |
| `precision` | `number` | Desired 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
| Name | Type | Default value | Description |
| :---------------- | :-------- | :------------ | :------------------- |
| `geohashStart` | `string` | `undefined` | The starting geohash |
| `geohashEnd` | `string` | `undefined` | The ending geohash |
| `includeStartEnd` | `boolean` | `false` | - |#### Returns
`string`[]
The list of geohashes between start and end