Module: GeoTreeModule

Defined in:
lib/geotree/loc.rb,
lib/geotree/node.rb,
lib/geotree/bounds.rb,
lib/geotree/geotree.rb,
lib/geotree/ptbuffer.rb,
lib/geotree/datapoint.rb,
lib/geotree/multitree.rb

Defined Under Namespace

Classes: Bounds, DataPoint, GeoTree, Loc, MultiTree, Node, NodeI, NodeL, Partition, PtBuffer, TreeStats

Constant Summary collapse

LOC_MAX =
((1 << 30)-1)
LOC_MIN =
-LOC_MAX
LAT_LONG_FACTOR_ =

Factor for converting integer locations to latitude/longitudes

180.0 / LOC_MAX
DATAPOINT_INTS =
4
PARTITION_INTS =
2
INT_BYTES =
4
DATAPOINT_BYTES =
DATAPOINT_INTS * INT_BYTES
KDTREE_BLOCKSIZE =
256
NODEI_CHILDREN =
(((KDTREE_BLOCKSIZE/INT_BYTES) - 6)/2)
NODEL_CAPACITY =
(((KDTREE_BLOCKSIZE/INT_BYTES) - 4)/4)
SPLIT_SIZE =

The maximum population of a leaf node (+ overflow nodes) without splitting (although splitting is disabled if the leaf bounds gets too small)

(NODEL_CAPACITY * 3)
SPLITTABLE_LINEAR_SIZE =

The size below which a bounds cannot be further subdivided (to convert a leaf node that’s at capacity to an internal node)

2
KD_CACHE_SIZE =
(100000/KDTREE_BLOCKSIZE)
HDR_FLAGS =

Block fields for Node base class (each is an int)

0
HDR_INTS =
1
IFLD_POPULATION =

Block fields for NodeI subclass

HDR_INTS
IFLD_PARTITIONS =
IFLD_POPULATION + 1
IFLD_INTS =
IFLD_PARTITIONS + NODEI_CHILDREN * PARTITION_INTS
LFLD_OVERFLOW =

Block fields for NodeL subclass

HDR_INTS
LFLD_USED =
LFLD_OVERFLOW+1
LFLD_DATAPOINTS =
LFLD_USED+1
LFLD_INTS =
(LFLD_DATAPOINTS + NODEL_CAPACITY * DATAPOINT_INTS)
MAX_POINT_WEIGHT =

1 + the maximum datapoint weight; must be power of 2

16