FeatureTree

class FeatureTree(featureCollection: FeatureCollection?)

FeatureTree is a class which stores FeatureCollections within an rtree which gives us faster spatial searching. The APIs are purely FeatureCollections - pass one in to create the tree and then call one of generateFeatureCollection, generateNearbyFeatureCollection or generateNearestFeatureCollection to return a FeatureCollection trimmed down by location.

Constructors

Link copied to clipboard
constructor(featureCollection: FeatureCollection?)

Properties

Link copied to clipboard
var tree: RTree<Feature, Geometry?>?

Functions

Link copied to clipboard

generateFeatureCollection returns a FeatureCollection containing all of the features from within the rtree.

Link copied to clipboard

generateNearbyFeatureCollection returns a FeatureCollection containing all of the features within distance of the location provided

Link copied to clipboard

generateNearestFeatureCollection returns a FeatureCollection containing the nearest members of the rtree that are also within distance.

Link copied to clipboard
fun getNearestFeature(location: LngLatAlt, distance: Double = Double.POSITIVE_INFINITY): Feature?

getNearestFeature returns a Feature that is the nearest member of the rtree that is also within distance.

Link copied to clipboard