Rtree bulk loading

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Rtree bulk loading

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

Regards, Hussein


This message and its contents, including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email.
_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Reply | Threaded
Open this post in threaded view
|

Re: Rtree bulk loading

Adam Wulkiewicz
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:
http://www.boost.org/doc/libs/1_58_0/libs/geometry/doc/html/geometry/spatial_indexes/creation_and_modification.html#geometry.spatial_indexes.creation_and_modification.additional_interface
http://www.boost.org/doc/libs/1_58_0/libs/geometry/doc/html/geometry/spatial_indexes/rtree_examples/range_adaptors.html
http://www.boost.org/doc/libs/1_58_0/libs/geometry/doc/html/geometry/reference/spatial_indexes/boost__geometry__index__rtree/rtree_iterator__iterator_.html
http://www.boost.org/doc/libs/1_58_0/libs/geometry/doc/html/geometry/reference/spatial_indexes/boost__geometry__index__rtree/rtree_range_const___.html

Regards,
Adam
_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry