Boost logo

Geometry :

Subject: [geometry] R-tree spacial predicates (intersects(Ring) ...) in boost 1.59 upwards
From: Mike Vasiljevs (mike.vasiljevs_at_[hidden])
Date: 2016-05-05 09:33:12


Good day to everyone,

Tried the latest boost versions, however *rtree insersects query* does not
accept ring, polygon and multipolygon any more - since 1.59 - when applied
on boxes. However it is still present in the documentation (
http://www.boost.org/doc/libs/1_60_0/libs/geometry/doc/html/geometry/spatial_indexes/queries.html#geometry.spatial_indexes.queries.spatial_predicates
).

One could run a query on R-tree of boxes using a ring in boost 1.58.0 but
not any longer. I could not find any relevant discussion but perhaps there
is a good reason for this?

Example:
----------------------------------------------------------------
#include <vector>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/index/rtree.hpp>

void testSpacialIndexing()
{
namespace bg = boost::geometry;
namespace bgm = boost::geometry::model;
namespace bgi = boost::geometry::index;

typedef bgm::d2::point_xy<double> P;
typedef bgm::box<P> B;

P qpt;
B qbox;
bgm::ring<P> qring;
bgm::polygon<P> qpoly;
bgm::multi_polygon<bgm::polygon<P>> qmpoly;
bgm::segment<P> qseg;
bgm::linestring<P> qls;

// spacial indexing example
typedef std::pair<B, int> Value_t;
bgi::rtree<Value_t, bgi::quadratic<8>> rtree1;

std::vector<Value_t> found;

// works for all versions
rtree1.query(bgi::intersects(qpt), back_inserter(found));
rtree1.query(bgi::intersects(qbox), back_inserter(found));
rtree1.query(bgi::intersects(qseg), back_inserter(found));
rtree1.query(bgi::intersects(qls), back_inserter(found));

// does not work for 1.59 to 1.61 beta
rtree1.query(bgi::intersects(qring), back_inserter(found));
rtree1.query(bgi::intersects(qpoly), back_inserter(found));
rtree1.query(bgi::intersects(qmpoly), back_inserter(found));
}

----------------------------------------------------------------

Best greetings,
Mike



Geometry list run by mateusz at loskot.net