A very fast static spatial index for 2D points based on a flat KD-tree.
Compared to QgsSpatialIndex, this index:
- supports single point features only (no multipoints)
- is static (features cannot be added or removed from the index after construction)
- is much faster!
- allows direct retrieval of the original feature's points, without requiring additional feature requests
- supports true "distance based" searches, i.e. return all points within a radius from a search point
QgsSpatialIndexKDBush objects are implicitly shared and can be inexpensively copied.
- See also
- QgsSpatialIndex, which is an general, mutable index for geometry bounding boxes.
- Since
- QGIS 3.4
Definition at line 54 of file qgsspatialindexkdbush.h.
Constructor - creates KDBush index and bulk loads it with features from the iterator.
The optional feedback object can be used to allow cancellation of bulk feature loading. Ownership of feedback is not transferred, and callers must take care that the lifetime of feedback exceeds that of the spatial index construction.
Any non-single point features encountered during iteration will be ignored and not included in the index.
Definition at line 24 of file qgsspatialindexkdbush.cpp.
Constructor - creates KDBush index and bulk loads it with features from the source.
The optional feedback object can be used to allow cancellation of bulk feature loading. Ownership of feedback is not transferred, and callers must take care that the lifetime of feedback exceeds that of the spatial index construction.
Any non-single point features encountered during iteration will be ignored and not included in the index.
Definition at line 30 of file qgsspatialindexkdbush.cpp.
Constructor - creates KDBush index and bulk loads it with features from the source.
This constructor allows for a callback function to be specified, which is called for each added feature in turn. It allows for bulk spatial index load along with other feature based operations on a single iteration through a feature source. If callback returns false
, the load and iteration is canceled.
The optional feedback object can be used to allow cancellation of bulk feature loading. Ownership of feedback is not transferred, and callers must take care that the lifetime of feedback exceeds that of the spatial index construction.
Any non-single point features encountered during iteration will be ignored and not included in the index.
- Note
- Not available in Python bindings
- Since
- QGIS 3.22