this example, I wrote one method for allowing rtree.query to work: i want to get intersects with two segments
using Point2d =
boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>;
using Segment2d = boost::geometry::model::segment<Point2d>;
using SegmentRtree =
boost::geometry::index::rtree<Segment2d, boost::geometry::index::rstar<16>>;
for (int point_index = 0;
point_index + 1 < segment.line_segment().point_size();
point_index++) {
const Segment2d segment_in_range = {
{segment.line_segment().point()[point_index].x(),
segment.line_segment().point()[point_index].y()},
{segment.line_segment().point()[point_index + 1].x(),
segment.line_segment().point()[point_index + 1].y()}};
uncrossable_segments_in_range.insert(segment_in_range);
Some of the errors I am getting:
/home/xx/xx/xx/xx/xx/xx/xx/xx.cc:220:66: required from here
/home/xx/xx/xx/build_x86/_deps/boost-src/include/boost/geometry/strategies/index/services.hpp:31:5: error: static assertion failed: Not implemented for this coordinate system.
31 | BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It looks 100% like you've forgotten to include some header.
The message doesn't state "you don't specify a coordinate system" (you do, it's in your point type). It says "the specialization (for this algorithm/strategy/trait etc...) for this combination has not been found".
Code Forensics
However, you don't show the includes, so we can't tell. Also, the code you do show refers to a lot of proprietary types not related to Boost Geometry (
point_size(),line_segment(),point()[]all seem unrelated to Boost Geometry).Even the
.x()and.y()contradict the point type you defined.point<>does not have these members.boost::geometry::model::d2::point_xy<>does, though.So, the best I can do is make up a lot (!!!) of code to make your code compile:
Live On Coliru
It would help a little to make your loop more readable:
Now, this looks like improbable amounts of (poor) code to have to imagine. Also, it does nothing with
rtree, which is supposedly your question?Brainwave - More reasonable code
I just had a brainwave. Probably
uncrossable_segments_in_rangewas supposed to be yourrtree? And the whole loop was building the rtree from [some unrelated data structure]. Here's how I imagine you'd write that code:Live On Coliru
Which prints
Summary
In all likelihood, you just had to add one of the includes you can cross-reference from my examples.