new DataStore()

Members


data :Array

Description
Array of data objects

types :Array

Description
Array of data types

kdtree :Kdtree

Description
Kdtree Object

isInit :boolean

Description
Has the kdtree been initialized?

init

Description
Initialize kdtree

addGeojson

Description
Adds data from geojson format
Parameters
Name Type Description
data Object data in geojson format

addGeojsonPoint

Description
Adds single geojson point feature
Parameters
Name Type Description
geojsonPoint Object Single geojson point feature to add

addDataPoint

Description
Adds data in datastore object format
Parameters
Name Type Description
newData Object Data in datastore object format

updateDataset

Description
Update datastore using lat,lon as keys, if element not found it will be added
Parameters
Name Type Description
newData Array Array of datastore formated objects to update

deleteDataset

Description
Delete all data and reset kdtree

getNearest

Description
Get nearest datapoints to target
Parameters
Name Type Description
lat number target latitude
lon * target longitude
maxDistance * max distance from target
maxCount * max number of datapoints to return

getElementFromId

Description
Find datapoint from id
Parameters
Name Type Description
id String Id to find
Returns
Datastore formated data object that matches id

getElementFromKey

Description
Find datapoint from properties key
Parameters
Name Type Description
key String properties key to find
Returns
Datastore formated data object that matches properties key

isHomogeneous

Description
Analyzes the dataset to determine if all object properties are same types
Returns

getTypeList

Description
Gets all types of the properties object, including mismatches
Returns
Object of all types

getMaxForKey

Description
Gets max value for key in properties object
Parameters
Name Type Description
key String key to index on. key's value must be numerical.
Returns
max value and id that contains it

getMinForKey

Description
Gets min value for key in properties object
Parameters
Name Type Description
key String key to index on. key's value must be numerical.
Returns
min value and id that contains it

getRangeForKey

Description
Gets min and max values for key in properties object
Parameters
Name Type Description
key String key to index on. key's value must be numerical.
Returns
min and max values and ids that contain them

mapKeyToRange

Description
Takes the range of a property and linearly maps to params.
Parameters
Name Type Description
key String key to index on. key's value must be numerical.
min number min value to be mapped to
max number max value to be mapped to