首页 > 解决方案 > 提升地理坐标的 Rtree

问题描述

我在 Boost Geometry 库中发现了一些对地理坐标(例如纬度/经度)的支持。

Boost 的 rtree 实现中是否支持地理坐标,如果支持,如何使用?我在文档中找不到任何内容(可能是不支持的提示)。

标签: boostboost-geometry

解决方案


您必须使用地理点/框类型定义 R-tree,例如:

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

using point = bg::point<double, 2, bg::cs::geographic<bg::degree>>;
using rtree_p = bgi::rtree<point, bgi::rstar<4>>;

using box = bg::box<point>;
using rtree_bi = bgi::rtree<std::pair<box, size_t>, bgi::rstar<16>>;

推荐阅读