Boost logo

Geometry :

Subject: Re: [geometry] Rtree bulk loading
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2015-06-17 09:47:22

Hi Hussein,

Hussein Almashouq wrote:
> Hi again , I'm looking for an example code the show how to bulk load
> using packing.

To create an rtree using packing algorithm you just have to pass a Range
into the rtree constructor:

namespace bgi = boost::geometry::index;
typedef std::pair<Box, int> Value;
typedef bgi::rtree< Value, bgi::linear<32> > RTree;

std::vector<Value> values;
/*fill the values container*/

RTree rt;
rt.insert(values.begin(), values.end());

To avoid the creation of an intermediate container of values you can use
Boost.Range adaptors to create a Range and pass it directly into the
rtree constructor.

See also:


Geometry list run by mateusz at