
2014-07-29 3:07 GMT+02:00 Jeremy Murphy <jeremy.william.murphy@gmail.com>:
Veering slightly off topic but still related to Geometry development, I've hit some hurdles with the rtree index. I could create an index of points easily but then couldn't query for the nearest neighbour of a segment. (I assume this is simply not supported at present; is it forthcoming?) So I created a ring or polygon from the segment and tried to query for the points that it covers/intersects, which is a feature listed in the documentation, but I've hit this compilation error:
/usr/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp:932:32: error: no matching function for call to ‘boost::geometry::model::referring_segment<const boost::geometry::model::d2::point_xy<double> >::referring_segment(const boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian>&, const boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian>&)’
This constructor for referring_segment looks OK to me, except maybe for the 'const' qualifier on the arguments?
Which version of Boost are you using? Indeed nearest(segment, ...) shouldn't work in 1.55. However intersects(ring_or_poly) should. Could you prepare some minimal failing example? E.g. this compiles for me, using develop branch (upcomming 1.56) or 1.55 without one, marked line: #include <boost/geometry.hpp> #include <boost/geometry/index/rtree.hpp> #include <boost/geometry/geometries/segment.hpp> #include <boost/geometry/geometries/ring.hpp> namespace bg = boost::geometry; namespace bgi = bg::index; typedef bg::model::point<double, 2, bg::cs::cartesian> P; typedef bg::model::segment<P> Seg; typedef bg::model::ring<P> Ring; typedef bg::model::polygon<P> Poly; typedef P V; int main() { typedef bgi::rtree<V, bgi::linear<16, 4> > RT; //typedef bgi::rtree<V, bgi::quadratic<16, 4> > RT; //typedef bgi::rtree<V, bgi::rstar<16, 4> > RT; RT rt; V v; rt.query(bgi::nearest(Seg(), 1), &v); // Using 1.55 without this line rt.query(bgi::intersects(Ring()), &v); rt.query(bgi::intersects(Poly()), &v); } Regards, Adam