加载中...
搜索中...
无匹配项
空间连接

与空间连接相关的 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。

函数文档

◆ 空间连接() [1/2]

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() )

在四叉树中搜索多边形或线串边界框的交集。

注意
二维坐标通过将每个 x/y 除以 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
返回值
一个包含两列的 cudf 表
  • bbox_offset - INT32 列,包含与四叉树相交的每个多边形/线串边界框的索引。
  • quad_offset - INT32 列,包含与多边形/线串边界框相交的每个叶象限的索引。

◆ 空间连接() [2/2]

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() )

在四叉树中搜索多边形或线串边界框的交集。

注意
二维坐标通过将每个 x/y 除以 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用于输出设备内存分配的可选资源。
返回值
一对 UINT32 边界框和叶象限偏移设备向量。
  • bbox_offset - 与四叉树相交的每个多边形/线串边界框的索引。
  • quad_offset - 与多边形/线串边界框相交的每个叶象限的索引。
异常
cuspatial::logic_error如果比例小于或等于 0
cuspatial::logic_error如果 max_depth 小于 1 或大于 15

◆ quadtree_point_in_polygon() [1/2]

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_pairscuspatial::join_quadtree_and_bounding_boxes 返回的 (多边形, 象限) 索引对的 cudf 表。
quadtree表示四叉树的 cudf 表(键、级别、是否内部节点、长度、偏移)。
point_indicescuspatial::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如果点和多边形顶点的类型不同。
返回值
一个包含两列的 cudf 表,每行表示一个点/多边形交集:polygon_offset - UINT32 多边形索引列 point_offset - UINT32 点索引列
注意
返回的多边形和点索引分别是 poly_quad_pairs 输入和 point_indices 中的偏移量。

◆ quadtree_point_in_polygon() [2/2]

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() )

测试指定的点是否在任何指定的多边形内部。

使用 cuspatial::join_quadtree_and_bounding_boxes 返回的 (多边形, 象限) 对,以确保仅测试与每个多边形位于同一象限中的点是否相交。

这种预过滤可以显著减少每个多边形测试的点数,从而以额外分配内存来存储四叉树和排序后的 point_indices 为代价,实现更快的交集测试。

参数
poly_indices_firstcuspatial::join_quadtree_and_bounding_boxes 返回的多边形索引序列的起始迭代器。
poly_indices_firstcuspatial::join_quadtree_and_bounding_boxes 返回的多边形索引序列的结束迭代器。
quad_indices_firstcuspatial::join_quadtree_and_bounding_boxes 返回的象限索引序列的起始迭代器。
quadtree使用 point_quadtree() 创建的四叉树引用。
point_indices_firstcuspatial::quadtree_on_points 返回的点索引序列的起始迭代器。
point_indices_lastcuspatial::quadtree_on_points 返回的点索引序列的结束迭代器。
points_first待测试的 (x, y) 点序列的起始迭代器。
polygons多边形的 multipolygon_range
stream执行计算的 CUDA 流。
mr用于输出设备内存分配的可选资源。
异常
cuspatial::logic_error如果环的数量少于多边形数量。
cuspatial::logic_error如果任何环的顶点少于四个。
cuspatial::logic_error如果多边形集合的数量不等于总多边形数量(每个多边形集合中有一个多边形)。
返回值
一对 rmm::device_uvector,每行表示一个点/多边形交集:polygon_offset - uint32_t 多边形索引 point_offset - uint32_t 点索引
注意
当前仅支持单多边形集合(single-polygon multipolygons)。
返回的多边形和点索引分别是 poly_quad_pairs 输入范围和 point_indices 范围中的偏移量。

◆ quadtree_point_to_nearest_linestring() [1/2]

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_pairscuspatial::join_quadtree_and_bounding_boxes 返回的 (线串, 象限) 索引对的 cudf 表。
quadtree表示四叉树的 cudf 表(键、级别、是否内部节点、长度、偏移)。
point_indicescuspatial::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如果点和线串顶点的类型不同。
返回值
一个包含三列的 cudf 表,每行表示一个点/线串对以及它们之间的距离。

point_offset - UINT32 点索引列 linestring_offset - UINT32 线串索引列 distance - FLOAT 或 DOUBLE 列(根据输入点数据类型),表示每个点与线串之间的距离。

注意
返回的点和线串索引分别是 point_indiceslinestring_quad_pairs 输入中的偏移量。

◆ quadtree_point_to_nearest_linestring() [2/2]

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() )

查找象限中每个点最近的线串,并计算每个点与线串之间的距离。

使用 cuspatial::join_quadtree_and_bounding_boxes 返回的 (线串, 象限) 对,以确保仅计算与每个线串位于同一象限中的点的距离。

参数
linestring_quad_pairscuspatial::join_quadtree_and_bounding_boxes 返回的 (线串, 象限) 索引对的 cudf 表。
quadtree表示四叉树的 cudf 表(键、级别、是否内部节点、长度、偏移)。
point_indicescuspatial::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如果点和线串顶点的类型不同。
返回值
一个包含三列的 cudf 表,每行表示一个点/线串对以及它们之间的距离。

point_offset - UINT32 点索引列 linestring_offset - UINT32 线串索引列 distance - FLOAT 或 DOUBLE 列(根据输入点数据类型),表示每个点与线串之间的距离。

注意
返回的点和线串索引分别是 point_indiceslinestring_quad_pairs 输入中的偏移量。

◆ sinusoidal_projection()

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) 坐标,单位为千米。

可用于将经度/纬度坐标近似转换为 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 的要求,并且是设备可访问的。
OutputItCartesian 输出点的迭代器。必须满足 LegacyRandomAccessIterator 的要求,并且是设备可访问和可变的。
T输入经度/纬度坐标的浮点坐标值类型。
前置条件
lonlat_first 可以等于 xy_first,但范围 [lonlat_first, lonlat_last) 不得与范围 [xy_first, xy_first + std::distance(lonlat_first, lonlat_last)) 重叠。
返回值
指向计算出的最后一个 x/y 坐标之后的元素的输出迭代器。