Loading...
Searching...
No Matches
spatial_join.cuh
1/*
2 * Copyright (c) 2022-2024, NVIDIA CORPORATION.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <cuspatial/detail/join/intersection.cuh>
20#include <cuspatial/detail/join/traversal.cuh>
21#include <cuspatial/iterator_factory.cuh>
22#include <cuspatial/point_quadtree.cuh>
23#include <cuspatial/traits.hpp>
24
25#include <rmm/device_uvector.hpp>
26#include <rmm/resource_ref.hpp>
27
28#include <iterator>
29#include <utility>
30
31namespace cuspatial {
32
63template <class BoundingBoxIterator,
64 class T = typename cuspatial::iterator_vec_base_type<BoundingBoxIterator>>
65std::pair<rmm::device_uvector<uint32_t>, rmm::device_uvector<uint32_t>>
67 point_quadtree_ref quadtree,
68 BoundingBoxIterator bounding_boxes_first,
69 BoundingBoxIterator bounding_boxes_last,
70 vec_2d<T> const& v_min,
71 T scale,
72 int8_t max_depth,
73 rmm::cuda_stream_view stream = rmm::cuda_stream_default,
74 rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
75
116template <class PolyIndexIterator,
117 class QuadIndexIterator,
118 class PointIndexIterator,
119 class PointIterator,
120 class MultiPolygonRange,
121 class IndexType = iterator_value_type<PointIndexIterator>>
122std::pair<rmm::device_uvector<IndexType>, rmm::device_uvector<IndexType>> quadtree_point_in_polygon(
123 PolyIndexIterator poly_indices_first,
124 PolyIndexIterator poly_indices_last,
125 QuadIndexIterator quad_indices_first,
126 point_quadtree_ref quadtree,
127 PointIndexIterator point_indices_first,
128 PointIndexIterator point_indices_last,
129 PointIterator points_first,
130 MultiPolygonRange polygons,
131 rmm::cuda_stream_view stream = rmm::cuda_stream_default,
132 rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
133
171template <class LinestringIndexIterator,
172 class QuadIndexIterator,
173 class PointIndexIterator,
174 class PointIterator,
175 class MultiLinestringRange,
176 typename IndexType = iterator_value_type<PointIndexIterator>,
177 typename T = iterator_vec_base_type<PointIterator>>
178std::tuple<rmm::device_uvector<IndexType>, rmm::device_uvector<IndexType>, rmm::device_uvector<T>>
180 LinestringIndexIterator linestring_indices_first,
181 LinestringIndexIterator linestring_indices_last,
182 QuadIndexIterator quad_indices_first,
183 point_quadtree_ref quadtree,
184 PointIndexIterator point_indices_first,
185 PointIndexIterator point_indices_last,
186 PointIterator points_first,
187 MultiLinestringRange linestrings,
188 rmm::cuda_stream_view stream = rmm::cuda_stream_default,
189 rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
190
191} // namespace cuspatial
192
193#include <cuspatial/detail/join/quadtree_bbox_filtering.cuh>
194#include <cuspatial/detail/join/quadtree_point_in_polygon.cuh>
195#include <cuspatial/detail/join/quadtree_point_to_nearest_linestring.cuh>
std::tuple< rmm::device_uvector< IndexType >, rmm::device_uvector< IndexType >, rmm::device_uvector< T > > 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())
Finds the nearest linestring to each point in a quadrant, and computes the distances between each poi...
std::pair< rmm::device_uvector< uint32_t >, rmm::device_uvector< uint32_t > > 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())
Search a quadtree for polygon or linestring bounding box intersections.
std::pair< rmm::device_uvector< IndexType >, rmm::device_uvector< IndexType > > 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())
Test whether the specified points are inside any of the specified polygons.