Hi,

W dniu 14.10.2019 o 16:57, vexakul via Boost-users pisze:

When you define the geographic point as R-tree element type the

computation should be done in geographic CS by default using WGS84

ellipsoid and andoyer formula to calculate distances. So simply:

using boost::geometry;

using point = model::point<double, 2, cs::geographic<degree>>;

using rtree = index::rtree<point, index::rstar<4>>;

rtree rt;

// or

std::vector<point> pts;

rtree rt2{pts.begin(), pts.end()};

If you need different ellipsoid or more accurate formula it is also

possible (since Boost 1.71) though it is not documented. It's because

I'm not entirely sure what to do with the fact that with this approach

the EqualTo is called with two or three arguments depending on the

parameters passed into the R-tree so it may be confusing. So there is

slight probability that the interface will change in case I found some

better way of defining CS-specific parts of the computation. So if you

e.g. need to pass a different ellipsoid you can wrap the R-tree

parameters together with Index strategy and pass it into the R-tree like

that:

using boost::geometry;

using formula = strategy::andoyer;// or more accurate strategy::vincenty

srs::spheroid<double> sph(6378137.0, 6356752.3142451793);

using point = model::point<double, 2, cs::geographic<degree>>;

using parameters = index::parameters

<

index::rstar<4>,

strategy::index::geographic<formula>

>;

using rtree = index::rtree<point, parameters>;

rtree rt{parameters{index::rstar<4>{},

strategy::index::geographic<formula>{sph}}};

// or

std::vector<point> pts;

rtree rt2{pts.begin(), pts.end(),

parameters{index::rstar<4>{},

strategy::index::geographic<formula>{sph}}};

Have in mind that I didn't test the code above so there may be some

mistakes.

Adam

_______________________________________________

Boost-users mailing list

[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users