@@ -25,13 +25,14 @@ def get_quadtree_kwargs(
2525 A dictionary of keyword arguments including x_min, x_max, y_min,
2626 y_max, scale, and max_depth.
2727 """
28- # Calculate bounds
29- x_min = float (points .points .x .min ())
30- x_max = float (points .points .x .max ())
31- y_min = float (points .points .y .min ())
32- y_max = float (points .points .y .max ())
33-
34- # Get hyperparams for quadtree
28+ # Calculate bounds | Optimisation: Use interleaved view, without copying data
29+ xy = cp .asarray (points .points .xy ).reshape (- 1 , 2 ) # zero-copy view
30+ x_min = float (xy [:, 0 ].min ())
31+ x_max = float (xy [:, 0 ].max ())
32+ y_min = float (xy [:, 1 ].min ())
33+ y_max = float (xy [:, 1 ].max ())
34+
35+ # Get hyperparams for quadtree
3536 extent = max (x_max - x_min , y_max - y_min )
3637 max_depth = 1
3738 while extent // (1 << max_depth ) > 0 :
@@ -140,7 +141,7 @@ def get_quadtree_index(
140141 points : cuspatial .GeoSeries ,
141142 max_size : int ,
142143 with_bounds : bool = True ,
143- ) -> tuple [cudf .Series , cudf .DataFrame ]:
144+ ) -> tuple [cudf .Series , cudf .DataFrame , dict ]:
144145 """Build a cuSpatial quadtree from 2D point data.
145146
146147 Parameters
@@ -190,7 +191,7 @@ def get_quadtree_index(
190191 y_max = y_max ,
191192 )
192193
193- return indices , quadtree
194+ return indices , quadtree , kwargs
194195
195196
196197def quadtree_to_geoseries (
0 commit comments