geohashes-along
v1.0.0
Published
Find the geohashes of a given precision along a GeoJSON LineString or MultiLineString Geometry or Feature.
Downloads
481
Readme
geohashes-along
Find the geohashes of a given precision along a GeoJSON LineString or MultiLineString Geometry or Feature.
Installation
Using npm, npm i geohashes-along
.
Using yarn, yarn add geohashes-along
.
Usage
Using import
:
import { getGeohashesAlong } from 'geohashes-along';
In a CommonJS environment:
const { getGeohashesAlong } = require('geohashes-along');
Then:
const lineString = {
type: 'LineString',
coordinates: [
[-5.646972656250001, 36.679433365517774],
[-5.52103918210534, 36.67588866176514],
],
};
const geohashesAlong = getGeohashesAlong(lineString, 5);
// geohashesAlong is ['eyebx', 'eys08', 'eys09', 'eys0d']
Table of contents
Functions
Functions
getGeohashesAlong
▸ getGeohashesAlong(feature
: Feature<LineString | MultiLineString> | LineString | MultiLineString, precision
: number): string[]
Get a list of geohashes along a LineString or MultiLineString GeoJSON Feature or Geometry. This is the generic method.
export
Parameters
| Name | Type | Description |
| :---------- | :------------------------------------------------------------------------- | :--------------------------------- |
| feature
| Feature<LineString | MultiLineString> | LineString | MultiLineString | The GeoJSON Feature or Geometry |
| precision
| number | The precision for the geohash list |
Returns: string[]
The list of geohashes along the line
getGeohashesAlongLineString
▸ getGeohashesAlongLineString(lineString
: LineString, precision
: number): string[]
Get a list of geohashes along a LineString Geometry
export
Parameters
| Name | Type | Description |
| :----------- | :--------- | :--------------------------------- |
| lineString
| LineString | The LineString Geometry |
| precision
| number | The precision for the geohash list |
Returns: string[]
The geohashes along the LineString
getGeohashesAlongMultiLineString
▸ getGeohashesAlongMultiLineString(multiLineString
: MultiLineString, precision
: number): string[]
Get a list of geohashes along a MultiLineString Geometry
export
Parameters
| Name | Type | Description |
| :---------------- | :-------------- | :--------------------------------- |
| multiLineString
| MultiLineString | The MultiLineString Geometry |
| precision
| number | The precision for the geohash list |
Returns: string[]
The geohashes along the MultiLineString