|  | Home | Libraries | People | FAQ | More | 
Finds values meeting passed predicates e.g. nearest to some Point and/or intersecting some Box.
This query function performs spatial and k-nearest neighbor searches. It allows to pass a set of predicates. Values will be returned only if all predicates are met.
Spatial predicates
Spatial predicates may be generated by one of the functions listed below:
It is possible to negate spatial predicates:
Satisfies predicate
This is a special kind of predicate which allows to pass a user-defined function or function object which checks if Value should be returned by the query. It's generated by:
Nearest predicate
If the nearest predicate is passed a k-nearest neighbor search will be performed. This query will result in returning k values to the output iterator. Only one nearest predicate may be passed to the query. It may be generated by:
Connecting predicates
            Predicates may be passed together connected with operator&&()
template<typename Value,typename Parameters,typename IndexableGetter,typename EqualTo,typename Allocator,typename Predicates,typename OutIter>rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator >::size_typequery(rtree< Value, Parameters, IndexableGetter, EqualTo, Allocator > const &tree,Predicates const &predicates,OutIterout_it)
| Type | Name | Description | 
|---|---|---|
| 
                       | 
                       | The rtree. | 
| 
                       | 
                       | Predicates. | 
| 
                       | 
                       | The output iterator, e.g. generated by std::back_inserter(). | 
The number of values found.
// return elements intersecting box bgi::query(tree, bgi::intersects(box), std::back_inserter(result)); // return elements intersecting poly but not within box bgi::query(tree, bgi::intersects(poly) && !bgi::within(box), std::back_inserter(result)); // return elements overlapping box and meeting my_fun value predicate bgi::query(tree, bgi::overlaps(box) && bgi::satisfies(my_fun), std::back_inserter(result)); // return 5 elements nearest to pt and elements are intersecting box bgi::query(tree, bgi::nearest(pt, 5) && bgi::intersects(box), std::back_inserter(result)); // For each found value do_something (it is a type of function object) tree.query(bgi::intersects(box), boost::make_function_output_iterator(do_something()));
If Value copy constructor or copy assignment throws.
| ![[Warning]](../../../../../../../../doc/src/images/warning.png) | Warning | 
|---|---|
| 
              Only one  |