|
Geometry : |
Subject: [ggl] rtree documentation?
From: Barend Gehrels (barend.gehrels)
Date: 2010-06-24 04:50:05
Hi Bernhard,
>
> I'm new to Boost.Geometry, and I have already found this
> docoumentation:
Welcome to the list!
>
> http://geometrylibrary.geodan.nl/index.html
>
> However, I wonder where I can find the documentation of (or
> some code snippets using) the rtree class?
They are not yet there. Sorry about that. The rtree interface will be
changed (and it was therefore not part of the review).
However, it works and can be used. Herewith a code snippet.
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
namespace bg = boost::geometry;
(...)
// declare a spatial index with an ID (int), the ID can also be e.g. an
index of a vector
bg::index::rtree<bg::box_2d, int> spatial_index(12, 4); // <box, ID>
(...)
// fill it somewhere, normally in a loop over polygons (here: polygon)
bg::box_2d envelope;
bg::envelope(polygon, envelope);
spatial_index.insert(envelope, id);
// get all ID's intersecting a specified box:
std::deque<int> overlapping =
spatial_index.find(specific_envelope);
// do things with these ID's / polygons belonging to these ID's or indexes
Regards, Barend
Geometry list run by mateusz at loskot.net