Class: STRtree

jsts.index.strtree.STRtree

new STRtree(nodeCapacityopt)

Constructs an STRtree with the default node capacity or with the given maximum number of child nodes that a node may have.

The minimum recommended capacity setting is 4.

Parameters:
Name Type Attributes Description
nodeCapacity number <optional>
Source:

Extends

Members

(protected) root :jsts.index.strtree.AbstractNode

Type:
Inherited From:
Source:

Methods

avg(a, b) → {number}

Parameters:
Name Type Description
a number
b number
Source:
Returns:
Type
number

boundablesAtLevel2(level, topopt, boundablesopt) → (nullable) {Array}

Parameters:
Name Type Attributes Description
level number
top jsts.index.strtree.AbstractNode <optional>
boundables Array <optional>
Inherited From:
Source:
Returns:
Type
Array

build()

Creates parent nodes, grandparent nodes, and so forth up to the root node, for the data that has been inserted into the tree. Can only be called once, and thus can be called only after all of the data has been inserted into the tree.
Inherited From:
Source:

centreX(e) → {number}

Parameters:
Name Type Description
e jsts.geom.Envelope
Source:
Returns:
Type
number

centreY(e) → {number}

Parameters:
Name Type Description
e jsts.geom.Envelope
Source:
Returns:
Type
number

compareDoubles(a, b) → {number}

Parameters:
Name Type Description
a number
b number
Inherited From:
Source:
Returns:
Type
number

(protected) createNode(level) → {jsts.index.strtree.AbstractNode}

Parameters:
Name Type Description
level number
Overrides:
Source:
Returns:
Type
jsts.index.strtree.AbstractNode

(protected) createParentBoundables(childBoundables, newLevel) → {Array}

Creates the parent level for the given child level. First, orders the items by the x-values of the midpoints, and groups them into vertical slices. For each slice, orders the items by the y-values of the midpoints, and group them into runs of size M (the node capacity). For each run, creates a new (parent) node.
Parameters:
Name Type Description
childBoundables Array
newLevel number
Overrides:
Source:
Returns:
Type
Array

(protected) createParentBoundablesFromVerticalSlice(childBoundables, newLevel) → {Array}

Parameters:
Name Type Description
childBoundables Array
newLevel number
Source:
Returns:
Type
Array

depth() → {number}

Returns the number of items in the tree.
Overrides:
Source:
Returns:
the number of items in the tree.
Type
number

depth2(nodeopt) → {number}

Parameters:
Name Type Attributes Description
node jsts.index.strtree.AbstractNode <optional>
Inherited From:
Source:
Returns:
Type
number

(protected) getComparator() → {Object}

Overrides:
Source:
Returns:
Type
Object

(protected) getIntersectsOp() → {jsts.index.strtree.AbstractSTRtree.IntersectsOp}

Overrides:
Source:
Returns:
Type
jsts.index.strtree.AbstractSTRtree.IntersectsOp

getNodeCapacity()

Returns the maximum number of child nodes that a node may have return {number}
Inherited From:
Source:

getRoot() → {jsts.index.strtree.AbstractNode}

Inherited From:
Source:
Returns:
Type
jsts.index.strtree.AbstractNode

insert(itemEnv, item)

Inserts an item having the given bounds into the tree.
Parameters:
Name Type Description
itemEnv jsts.geom.Envelope
item Object
Overrides:
Source:

itemsTree() → {Array}

Gets a tree structure (as a nested list) corresponding to the structure of the items and nodes in this tree.

The returned Lists contain either Object items, or Lists which correspond to subtrees of the tree Subtrees which do not contain any items are not included.

Builds the tree if necessary.

Inherited From:
Source:
Returns:
a List of items and/or Lists.
Type
Array

lastNode(nodes) → {jsts.index.strtree.AbstractNode}

Parameters:
Name Type Description
nodes Array
Inherited From:
Source:
Returns:
Type
jsts.index.strtree.AbstractNode

nearestNeighbour(itemDist) → {Array.<Object>}

Finds the two nearest items in the tree, using ItemDistance as the distance metric. A Branch-and-Bound tree traversal algorithm is used to provide an efficient search.
Parameters:
Name Type Description
itemDist ItemDistance a distance metric applicable to the items in this tree.
Source:
Returns:
the pair of the nearest items.
Type
Array.<Object>

nearestNeighbour2(env, item, itemDist) → {Array.<Object>}

Finds the nearest item to the given object in this tree, using ItemDistance as the distance metric. A Branch-and-Bound tree traversal algorithm is used to provide an efficient search.
Parameters:
Name Type Description
env Envelope the envelope of the query item.
item Object the item to find the nearest neighbour of.
itemDist ItemDistance a distance metric applicable to the items in this tree and the query item.
Source:
Returns:
the nearest item in this tree.
Type
Array.<Object>

nearestNeighbour3(tree, itemDist) → {Array.<Object>}

Finds the two nearest items from this tree and another tree, using ItemDistance as the distance metric. A Branch-and-Bound tree traversal algorithm is used to provide an efficient search. The result value is a pair of items, the first from this tree and the second from the argument tree.
Parameters:
Name Type Description
tree STRtree another tree.
itemDist ItemDistance a distance metric applicable to the items in the trees.
Source:
Returns:
the pair of the nearest items, one from each tree.
Type
Array.<Object>

nearestNeighbour5(initBndPair, maxDistance) → {Array}

NOTE: PriorityQueue replaces by js array
Parameters:
Name Type Description
initBndPair
maxDistance
Source:
Returns:
Type
Array

query(searchEnv, visitor) → {Array}

Returns items whose bounds intersect the given envelope.
Parameters:
Name Type Description
searchEnv jsts.geom.Envelope
visitor jsts.index.ItemVisitor
Overrides:
Source:
Returns:
Type
Array

remove(itemEnv, item) → {boolean}

Removes a single item from the tree.
Parameters:
Name Type Description
itemEnv jsts.geom.Envelope the Envelope of the item to remove.
item Object the item to remove.
Overrides:
Source:
Returns:
true if the item was found.
Type
boolean

removeItem(node, item) → {boolean}

Parameters:
Name Type Description
node jsts.index.strtree.AbstractNode
item Object
Inherited From:
Source:
Returns:
Type
boolean

size() → {number}

Returns the number of items in the tree.
Overrides:
Source:
Returns:
the number of items in the tree.
Type
number

size2(nodeopt) → {number}

Parameters:
Name Type Attributes Description
node jsts.index.strtree.AbstractNode <optional>
Inherited From:
Source:
Returns:
Type
number

(protected) verticalSlices(childBoundables, sliceCount) → {Array.<Array>}

Parameters:
Name Type Description
childBoundables Array
sliceCount number
Source:
Returns:
Type
Array.<Array>