与空间连接相关的 API。更多...
文件 | |
文件 | spatial_join.hpp |
函数 | |
template<class InputIt, class OutputIt, class T> | |
OutputIt | cuspatial::sinusoidal_projection (InputIt lon_lat_first, InputIt lon_lat_last, OutputIt xy_first, vec_2d< T > origin, rmm::cuda_stream_view stream=rmm::cuda_stream_default) |
将经度/纬度相对于原点进行正弦投影,得到 Cartesian (x/y) 坐标,单位为千米。 | |
template<class BoundingBoxIterator, class T = typename cuspatial::iterator_vec_base_type<BoundingBoxIterator>> | |
std::pair< rmm::device_uvector< uint32_t >, rmm::device_uvector< uint32_t > > | cuspatial::join_quadtree_and_bounding_boxes (point_quadtree_ref quadtree, BoundingBoxIterator bounding_boxes_first, BoundingBoxIterator bounding_boxes_last, vec_2d< T > const &v_min, T scale, int8_t max_depth, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource()) |
在四叉树中搜索多边形或线串边界框的交集。 | |
template<class PolyIndexIterator, class QuadIndexIterator, class PointIndexIterator, class PointIterator, class MultiPolygonRange, class IndexType = iterator_value_type<PointIndexIterator>> | |
std::pair< rmm::device_uvector< IndexType >, rmm::device_uvector< IndexType > > | cuspatial::quadtree_point_in_polygon (PolyIndexIterator poly_indices_first, PolyIndexIterator poly_indices_last, QuadIndexIterator quad_indices_first, point_quadtree_ref quadtree, PointIndexIterator point_indices_first, PointIndexIterator point_indices_last, PointIterator points_first, MultiPolygonRange polygons, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource()) |
测试指定的点是否在任何指定的多边形内部。 | |
template<class LinestringIndexIterator, class QuadIndexIterator, class PointIndexIterator, class PointIterator, class MultiLinestringRange, typename IndexType = iterator_value_type<PointIndexIterator>, typename T = iterator_vec_base_type<PointIterator>> | |
std::tuple< rmm::device_uvector< IndexType >, rmm::device_uvector< IndexType >, rmm::device_uvector< T > > | cuspatial::quadtree_point_to_nearest_linestring (LinestringIndexIterator linestring_indices_first, LinestringIndexIterator linestring_indices_last, QuadIndexIterator quad_indices_first, point_quadtree_ref quadtree, PointIndexIterator point_indices_first, PointIndexIterator point_indices_last, PointIterator points_first, MultiLinestringRange linestrings, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource()) |
查找象限中每个点最近的线串,并计算每个点与线串之间的距离。 | |
std::unique_ptr< cudf::table > | cuspatial::join_quadtree_and_bounding_boxes (cudf::table_view const &quadtree, cudf::table_view const &bbox, double x_min, double x_max, double y_min, double y_max, double scale, int8_t max_depth, rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource()) |
在四叉树中搜索多边形或线串边界框的交集。 | |
std::unique_ptr< cudf::table > | cuspatial::quadtree_point_in_polygon (cudf::table_view const &poly_quad_pairs, cudf::table_view const &quadtree, cudf::column_view const &point_indices, cudf::column_view const &point_x, cudf::column_view const &point_y, cudf::column_view const &poly_offsets, cudf::column_view const &ring_offsets, cudf::column_view const &poly_points_x, cudf::column_view const &poly_points_y, rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource()) |
测试指定的点是否在任何指定的多边形内部。 | |
std::unique_ptr< cudf::table > | cuspatial::quadtree_point_to_nearest_linestring (cudf::table_view const &linestring_quad_pairs, cudf::table_view const &quadtree, cudf::column_view const &point_indices, cudf::column_view const &point_x, cudf::column_view const &point_y, cudf::column_view const &linestring_offsets, cudf::column_view const &linestring_points_x, cudf::column_view const &linestring_points_y, rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource()) |
查找象限中每个点最近的线串,并计算每个点与线串之间的距离。 | |
与空间连接相关的 API。
std::unique_ptr< cudf::table > cuspatial::join_quadtree_and_bounding_boxes | ( | cudf::table_view const & | quadtree, |
cudf::table_view const & | bbox, | ||
double | x_min, | ||
double | x_max, | ||
double | y_min, | ||
double | y_max, | ||
double | scale, | ||
int8_t | max_depth, | ||
rmm::device_async_resource_ref | mr = rmm::mr::get_current_device_resource() ) |
在四叉树中搜索多边形或线串边界框的交集。
scale
转换为一维 Morton 码:((x - min_x) / scale
和 (y - min_y) / scale
)。max_depth
应小于 16,因为 Morton 码表示为 uint32_t
。如果点数很少或 max_size
很大,最终的层数可能小于 max_depth
。quadtree | 表示四叉树的 cudf 表(键、级别、是否内部节点、长度、偏移)。 |
bbox | 包含四个列(x_min, y_min, x_max, y_max)作为边界框的 cudf 表。 |
x_min | 感兴趣区域边界框的左下角 x 坐标。 |
x_max | 感兴趣区域边界框的右上角 x 坐标。 |
y_min | 感兴趣区域边界框的左下角 y 坐标。 |
y_max | 感兴趣区域边界框的右上角 y 坐标。 |
scale | 应用于每个 x 和 y 距离 (从 x_min 和 y_min 开始) 的缩放因子。 |
max_depth | 停止测试交集的最大四叉树深度。 |
mr | 用于输出设备内存分配的可选资源。 |
cuspatial::logic_error | 如果四叉树表格式不正确 |
cuspatial::logic_error | 如果边界框表格式不正确 |
cuspatial::logic_error | 如果比例小于或等于 0 |
cuspatial::logic_error | 如果 x_min 大于 x_max |
cuspatial::logic_error | 如果 y_min 大于 y_max |
cuspatial::logic_error | 如果 max_depth 小于 1 或大于 15 |
std::pair< rmm::device_uvector< uint32_t >, rmm::device_uvector< uint32_t > > cuspatial::join_quadtree_and_bounding_boxes | ( | point_quadtree_ref | quadtree, |
BoundingBoxIterator | bounding_boxes_first, | ||
BoundingBoxIterator | bounding_boxes_last, | ||
vec_2d< T > const & | v_min, | ||
T | scale, | ||
int8_t | max_depth, | ||
rmm::cuda_stream_view | stream = rmm::cuda_stream_default, | ||
rmm::device_async_resource_ref | mr = rmm::mr::get_current_device_resource() ) |
在四叉树中搜索多边形或线串边界框的交集。
scale
转换为一维 Morton 码:((x - min_x) / scale
和 (y - min_y) / scale
)。max_depth
应小于 16,因为 Morton 码表示为 uint32_t
。如果点数很少或 max_size
很大,最终的层数可能小于 max_depth
。quadtree | 使用 point_quadtree() 创建的四叉树引用。 |
bounding_boxes_first | 边界框起始迭代器 |
bounding_boxes_last | 边界框结束迭代器 |
v_min | 感兴趣区域边界框的左下角 (x, y) 坐标。 |
scale | 应用于每个 x 和 y 距离 (从 x_min 和 y_min 开始) 的缩放因子。 |
max_depth | 停止测试交集的最大四叉树深度。 |
stream | 执行计算的 CUDA 流。 |
mr | 用于输出设备内存分配的可选资源。 |
cuspatial::logic_error | 如果比例小于或等于 0 |
cuspatial::logic_error | 如果 max_depth 小于 1 或大于 15 |
std::unique_ptr< cudf::table > cuspatial::quadtree_point_in_polygon | ( | cudf::table_view const & | poly_quad_pairs, |
cudf::table_view const & | quadtree, | ||
cudf::column_view const & | point_indices, | ||
cudf::column_view const & | point_x, | ||
cudf::column_view const & | point_y, | ||
cudf::column_view const & | poly_offsets, | ||
cudf::column_view const & | ring_offsets, | ||
cudf::column_view const & | poly_points_x, | ||
cudf::column_view const & | poly_points_y, | ||
rmm::device_async_resource_ref | mr = rmm::mr::get_current_device_resource() ) |
测试指定的点是否在任何指定的多边形内部。
使用 cuspatial::join_quadtree_and_bounding_boxes
返回的 (多边形, 象限) 对表,以确保仅测试与每个多边形位于同一象限中的点是否相交。
这种预过滤可以显著减少每个多边形测试的点数,从而以额外分配内存来存储四叉树和排序后的 point_indices 为代价,实现更快的交集测试。
poly_quad_pairs | cuspatial::join_quadtree_and_bounding_boxes 返回的 (多边形, 象限) 索引对的 cudf 表。 |
quadtree | 表示四叉树的 cudf 表(键、级别、是否内部节点、长度、偏移)。 |
point_indices | cuspatial::quadtree_on_points 返回的排序点索引。 |
point_x | 待测试点的 x 坐标。 |
point_y | 待测试点的 y 坐标。 |
poly_offsets | 每个多边形中第一个环的起始索引(即前缀和)。 |
ring_offsets | 每个环中第一个点的起始索引(即前缀和)。 |
poly_points_x | 多边形点 x 坐标。 |
poly_points_y | 多边形点 y 坐标。 |
mr | 用于输出设备内存分配的可选资源。 |
cuspatial::logic_error | 如果 poly_quad_pairs 表格式不正确。 |
cuspatial::logic_error | 如果四叉树表格式不正确。 |
cuspatial::logic_error | 如果点索引的数量与点数不匹配。 |
cuspatial::logic_error | 如果环的数量少于多边形数量。 |
cuspatial::logic_error | 如果任何环的顶点少于三个。 |
cuspatial::logic_error | 如果点和多边形顶点的类型不同。 |
poly_quad_pairs
输入和 point_indices
中的偏移量。std::pair< rmm::device_uvector< IndexType >, rmm::device_uvector< IndexType > > cuspatial::quadtree_point_in_polygon | ( | PolyIndexIterator | poly_indices_first, |
PolyIndexIterator | poly_indices_last, | ||
QuadIndexIterator | quad_indices_first, | ||
point_quadtree_ref | quadtree, | ||
PointIndexIterator | point_indices_first, | ||
PointIndexIterator | point_indices_last, | ||
PointIterator | points_first, | ||
MultiPolygonRange | polygons, | ||
rmm::cuda_stream_view | stream = rmm::cuda_stream_default, | ||
rmm::device_async_resource_ref | mr = rmm::mr::get_current_device_resource() ) |
测试指定的点是否在任何指定的多边形内部。
使用 cuspatial::join_quadtree_and_bounding_boxes
返回的 (多边形, 象限) 对,以确保仅测试与每个多边形位于同一象限中的点是否相交。
这种预过滤可以显著减少每个多边形测试的点数,从而以额外分配内存来存储四叉树和排序后的 point_indices 为代价,实现更快的交集测试。
poly_indices_first | cuspatial::join_quadtree_and_bounding_boxes 返回的多边形索引序列的起始迭代器。 |
poly_indices_first | cuspatial::join_quadtree_and_bounding_boxes 返回的多边形索引序列的结束迭代器。 |
quad_indices_first | cuspatial::join_quadtree_and_bounding_boxes 返回的象限索引序列的起始迭代器。 |
quadtree | 使用 point_quadtree() 创建的四叉树引用。 |
point_indices_first | cuspatial::quadtree_on_points 返回的点索引序列的起始迭代器。 |
point_indices_last | cuspatial::quadtree_on_points 返回的点索引序列的结束迭代器。 |
points_first | 待测试的 (x, y) 点序列的起始迭代器。 |
polygons | 多边形的 multipolygon_range。 |
stream | 执行计算的 CUDA 流。 |
mr | 用于输出设备内存分配的可选资源。 |
cuspatial::logic_error | 如果环的数量少于多边形数量。 |
cuspatial::logic_error | 如果任何环的顶点少于四个。 |
cuspatial::logic_error | 如果多边形集合的数量不等于总多边形数量(每个多边形集合中有一个多边形)。 |
poly_quad_pairs
输入范围和 point_indices
范围中的偏移量。std::unique_ptr< cudf::table > cuspatial::quadtree_point_to_nearest_linestring | ( | cudf::table_view const & | linestring_quad_pairs, |
cudf::table_view const & | quadtree, | ||
cudf::column_view const & | point_indices, | ||
cudf::column_view const & | point_x, | ||
cudf::column_view const & | point_y, | ||
cudf::column_view const & | linestring_offsets, | ||
cudf::column_view const & | linestring_points_x, | ||
cudf::column_view const & | linestring_points_y, | ||
rmm::device_async_resource_ref | mr = rmm::mr::get_current_device_resource() ) |
查找象限中每个点最近的线串,并计算每个点与线串之间的距离。
使用 cuspatial::join_quadtree_and_bounding_boxes
返回的 (线串, 象限) 对表,以确保仅计算与每个线串位于同一象限中的点的距离。
linestring_quad_pairs | cuspatial::join_quadtree_and_bounding_boxes 返回的 (线串, 象限) 索引对的 cudf 表。 |
quadtree | 表示四叉树的 cudf 表(键、级别、是否内部节点、长度、偏移)。 |
point_indices | cuspatial::quadtree_on_points 返回的排序点索引。 |
point_x | 待测试点的 x 坐标。 |
point_y | 待测试点的 y 坐标。 |
linestring_offsets | 每个线串中第一个点的起始索引(即前缀和)。 |
linestring_points_x | 线串点 x 坐标。 |
linestring_points_y | 线串点 y 坐标。 |
mr | 用于输出设备内存分配的可选资源。 |
cuspatial::logic_error | 如果 linestring_quad_pairs 表格式不正确。 |
cuspatial::logic_error | 如果四叉树表格式不正确。 |
cuspatial::logic_error | 如果点索引的数量与点数不匹配。 |
cuspatial::logic_error | 如果任何线串的顶点少于两个。 |
cuspatial::logic_error | 如果点和线串顶点的类型不同。 |
point_offset - UINT32 点索引列 linestring_offset - UINT32 线串索引列 distance - FLOAT 或 DOUBLE 列(根据输入点数据类型),表示每个点与线串之间的距离。
point_indices
和 linestring_quad_pairs
输入中的偏移量。std::tuple< rmm::device_uvector< IndexType >, rmm::device_uvector< IndexType >, rmm::device_uvector< T > > cuspatial::quadtree_point_to_nearest_linestring | ( | LinestringIndexIterator | linestring_indices_first, |
LinestringIndexIterator | linestring_indices_last, | ||
QuadIndexIterator | quad_indices_first, | ||
point_quadtree_ref | quadtree, | ||
PointIndexIterator | point_indices_first, | ||
PointIndexIterator | point_indices_last, | ||
PointIterator | points_first, | ||
MultiLinestringRange | linestrings, | ||
rmm::cuda_stream_view | stream = rmm::cuda_stream_default, | ||
rmm::device_async_resource_ref | mr = rmm::mr::get_current_device_resource() ) |
查找象限中每个点最近的线串,并计算每个点与线串之间的距离。
使用 cuspatial::join_quadtree_and_bounding_boxes
返回的 (线串, 象限) 对,以确保仅计算与每个线串位于同一象限中的点的距离。
linestring_quad_pairs | cuspatial::join_quadtree_and_bounding_boxes 返回的 (线串, 象限) 索引对的 cudf 表。 |
quadtree | 表示四叉树的 cudf 表(键、级别、是否内部节点、长度、偏移)。 |
point_indices | cuspatial::quadtree_on_points 返回的排序点索引。 |
point_x | 待测试点的 x 坐标。 |
point_y | 待测试点的 y 坐标。 |
linestring_offsets | 每个线串中第一个点的起始索引(即前缀和)。 |
linestring_points_x | 线串点 x 坐标。 |
linestring_points_y | 线串点 y 坐标。 |
mr | 用于输出设备内存分配的可选资源。 |
cuspatial::logic_error | 如果 linestring_quad_pairs 表格式不正确。 |
cuspatial::logic_error | 如果四叉树表格式不正确。 |
cuspatial::logic_error | 如果点索引的数量与点数不匹配。 |
cuspatial::logic_error | 如果任何线串的顶点少于两个。 |
cuspatial::logic_error | 如果点和线串顶点的类型不同。 |
point_offset - UINT32 点索引列 linestring_offset - UINT32 线串索引列 distance - FLOAT 或 DOUBLE 列(根据输入点数据类型),表示每个点与线串之间的距离。
point_indices
和 linestring_quad_pairs
输入中的偏移量。OutputIt cuspatial::sinusoidal_projection | ( | InputIt | lon_lat_first, |
InputIt | lon_lat_last, | ||
OutputIt | xy_first, | ||
vec_2d< T > | origin, | ||
rmm::cuda_stream_view | stream = rmm::cuda_stream_default ) |
将经度/纬度相对于原点进行正弦投影,得到 Cartesian (x/y) 坐标,单位为千米。
可用于将经度/纬度坐标近似转换为 Cartesian 坐标,前提是所有点都靠近原点。误差随距离原点的增加而增大。有关详细信息,请参阅正弦投影。
value_type
cuspatial::vec_2d<T>
(经度/纬度坐标),并且输出迭代器必须能够接受存储类型为 cuspatial::vec_2d<T>
(Cartesian 坐标)的值。[in] | lon_lat_first | 输入经度/纬度坐标范围的起始。 |
[in] | lon_lat_last | 输入经度/纬度坐标范围的结束。 |
[in] | origin | 原点的经度和纬度。 |
[out] | xy_first | 输出 x/y 坐标范围的起始。 |
[in] | stream | 执行计算和分配内存的 CUDA 流。 |
InputIt | 经度/纬度位置的迭代器。必须满足 LegacyRandomAccessIterator 的要求,并且是设备可访问的。 |
OutputIt | Cartesian 输出点的迭代器。必须满足 LegacyRandomAccessIterator 的要求,并且是设备可访问和可变的。 |
T | 输入经度/纬度坐标的浮点坐标值类型。 |
lonlat_first
可以等于 xy_first
,但范围 [lonlat_first, lonlat_last)
不得与范围 [xy_first, xy_first + std::distance(lonlat_first, lonlat_last))
重叠。