Hi Jeremy,

Jeremy Murphy wrote:
Hi Adam,

thanks for the detailed answer. I haven't used Boost.Geometry rtree in a while, so I'm stuck already.  :\  
I created an rtree of 2D Cartesian points, that's fine. But when I tried to do a query using a nearest(segment, 1) predicate, I get a compilation error that looks like comparable_distance is not-yet-implemented between SEGMENT and BOX.

<snip>

Did I use it incorrectly or is it actually just not yet supported? I'm using the head of develop.

It is supported. It's hard to tell what may be the problem in your case without the code. The following code compiles and runs correctly for me:

#include <boost/geometry.hpp>
#include <boost/geometry/index/rtree.hpp>

#include <iostream>
#include <vector>

namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;

int main()
{
    typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
    typedef bg::model::box<point_t> box_t;
    typedef bg::model::segment<point_t> segment_t;
    typedef bg::model::referring_segment<point_t> ref_segment_t;

    bgi::rtree<point_t, bgi::rstar<4> > rt;

    for (double x = 0 ; x < 10 ; x += 2)
        for (double y = 0 ; y < 10 ; y += 2)
            rt.insert(point_t{x, y});

    point_t res;
    segment_t seg{{1, 1},{3, 1}};
    ref_segment_t ref_seg{seg.first, seg.second};
   
    size_t f = rt.query(bgi::nearest(seg, 1), &res);
    if (f > 0)
        std::cout << bg::wkt(res) << std::endl;

    f = rt.query(bgi::nearest(ref_seg, 1), &res);
    if (f > 0)
        std::cout << bg::wkt(res) << std::endl;

    bg::comparable_distance(segment_t(), point_t());
    bg::comparable_distance(point_t(), segment_t());
    bg::comparable_distance(segment_t(), box_t());
    bg::comparable_distance(box_t(), segment_t());
}

Adam