0.2.0 • Published 3 years ago

geohashes-clusterer v0.2.0

Weekly downloads
235
License
MIT
Repository
-
Last release
3 years ago

geohashes-clusterer

Table of contents

Functions

Functions

assignClusterToGeohashes

assignClusterToGeohashes(data: any[], geohashProp: string, valueProp: string, bucketsArray: Buckets): ClusteredGeohashItem[]

Assigns a cluster to each geohash based on provided buckets

export

Parameters:

NameTypeDescription
dataany[]The input data, it can have any props, but only 2 will be used
geohashPropstringThe prop holding the geohash string
valuePropstringThe prop holding the value (number)
bucketsArrayBucketsThe buckets array expressing min and max. Will check if geohash value is greater or equal than the bucket start, or smaller than the bucket max

Returns: ClusteredGeohashItem[]

The geohash list with an assigned bucket

Defined in: index.ts:25


clusterGeohashesAsGeoJSON

clusterGeohashesAsGeoJSON(data: any[], geohashProp: string, valueProp: string, buckets: Buckets): FeatureCollection<Polygon | MultiPolygon>

Creates a GeoJSON FeatureCollection with the clusters as Features

export

Parameters:

NameTypeDescription
dataany[]The input data, it can have any props, but only 2 will be used
geohashPropstringThe prop holding the geohash string
valuePropstringThe prop holding the value (number)
bucketsBucketsThe buckets array expressing min and max. Will check if geohash value is greater or equal than the bucket start, or smaller than the bucket max

Returns: FeatureCollection<Polygon | MultiPolygon>

The resulting FeatureCollection. Each Feature has the cluster name in its properties

Defined in: index.ts:65


clusterGeohashesByValue

clusterGeohashesByValue(data: any[], geohashProp: string, valueProp: string, bucketsArray: Buckets): ClusterObj

Clusters geohashes into an object, with the cluster tag as prop and the arrays of clustered geohashes as value

export

Parameters:

NameTypeDescription
dataany[]The input data, it can have any props, but only 2 will be used
geohashPropstringThe prop holding the geohash string
valuePropstringThe prop holding the value (number)
bucketsArrayBucketsThe buckets array expressing min and max. Will check if geohash value is greater or equal than the bucket start, or smaller than the bucket max

Returns: ClusterObj

The object holding the clusters and its members

Defined in: index.ts:50