npm i geohash-to-geojson
yarn add geohash-to-geojson
Then import the desired functions in your code
import {geohashToPolygonFeature} from 'geohash-to-geojson';
geohashToPolygonFeature('ezjmgz');
...
- geohashToCircleFeature
- geohashToCircleGeometry
- geohashToPointFeature
- geohashToPolygonFeature
- geohashToPolygonGeometry
- geohashesToFeatureCollection
- wrapAsFeatureCollection
Ƭ CircleOptions: Object
Name | Type |
---|---|
ruler? |
CheapRuler |
steps? |
number |
▸ geohashToCircleFeature(geohash
, percentage
, properties?
, options?
): Feature
<Polygon
>
Converts geohash to a circle Feature, based on % of the size desired
export
Name | Type | Description |
---|---|---|
geohash |
string |
Geohash to convert to circle |
percentage |
number |
Percentage of the geohash area to cover with the circle |
properties |
GeoJsonProperties |
- |
options? |
CircleOptions |
- |
Feature
<Polygon
>
The geohash as a circle Polygon Feature
▸ geohashToCircleGeometry(geohash
, percentage
, options?
): Polygon
Converts geohash to a circle Polygon Geometry, based on % of the size desired
export
Name | Type | Description |
---|---|---|
geohash |
string |
Geohash to convert to circle |
percentage |
number |
Percentage of the geohash area to cover with the circle |
options? |
CircleOptions |
- |
Polygon
The geohash as a circle Polygon Geometry
▸ geohashToPointFeature(geohash
, properties?
): Feature
<Point
>
Converts geohash to point feature, for centroid coordinates
export
Name | Type | Description |
---|---|---|
geohash |
string |
Geohash to convert to Point Feature |
properties |
GeoJsonProperties |
- |
Feature
<Point
>
The geohash centroid as a Point Feature
▸ geohashToPolygonFeature(geohash
, properties?
): Feature
<Polygon
>
Converts geohash to polygon Feature
export
Name | Type | Description |
---|---|---|
geohash |
string |
Geohash to convert to Polygon Feature |
properties |
GeoJsonProperties |
- |
Feature
<Polygon
>
▸ geohashToPolygonGeometry(geohash
): Polygon
Converts geohash to polygon Geometry
export
Name | Type | Description |
---|---|---|
geohash |
string |
Geohash to get as Polygon Geometry |
Polygon
The Polygon Geometry representing the geohash
▸ geohashesToFeatureCollection(hashes
): FeatureCollection
Converts array of geohashes to GeoJSON FeatureCollection
export
Name | Type | Description |
---|---|---|
hashes |
string [] |
Geohashes to wrap into FeatureCollection |
FeatureCollection
FeatureCollection with each geohash as a Polygon Feature inside
▸ wrapAsFeatureCollection(featuresArray
): FeatureCollection
Helper function to wrap geohash features converted using geohashToPolygonFeature in a FeatureCollection
export
Name | Type | Description |
---|---|---|
featuresArray |
Feature <Geometry , GeoJsonProperties >[] |
Features array to wrap inside the FeatureCollection |
FeatureCollection
FeatureCollection wrapping the Features