@@ -348,8 +348,10 @@ def hilbert_distance(self, total_bounds=None, level=16):
348
348
total_bounds : 4-element array, optional
349
349
The spatial extent in which the curve is constructed (used to
350
350
rescale the geometry midpoints). By default, the total bounds
351
- of the full dask GeoDataFrame will be computed. If known, you
352
- can pass the total bounds to avoid this extra computation.
351
+ of the full dask GeoDataFrame will be computed (from the spatial
352
+ partitions, if available, otherwise computed from the full
353
+ dataframe). If known, you can pass the total bounds to avoid this
354
+ extra computation.
353
355
level : int (1 - 16), default 16
354
356
Determines the precision of the curve (points on the curve will
355
357
have coordinates in the range [0, 2^level - 1]).
@@ -362,7 +364,10 @@ def hilbert_distance(self, total_bounds=None, level=16):
362
364
"""
363
365
# Compute total bounds of all partitions rather than each partition
364
366
if total_bounds is None :
365
- total_bounds = self .total_bounds
367
+ if self .spatial_partitions is not None :
368
+ total_bounds = self .spatial_partitions .total_bounds
369
+ else :
370
+ total_bounds = self .total_bounds
366
371
367
372
# Calculate hilbert distances for each partition
368
373
distances = self .map_partitions (
@@ -396,20 +401,25 @@ def morton_distance(self, total_bounds=None, level=16):
396
401
total_bounds : 4-element array, optional
397
402
The spatial extent in which the curve is constructed (used to
398
403
rescale the geometry midpoints). By default, the total bounds
399
- of the full dask GeoDataFrame will be computed. If known, you
400
- can pass the total bounds to avoid this extra computation.
404
+ of the full dask GeoDataFrame will be computed (from the spatial
405
+ partitions, if available, otherwise computed from the full
406
+ dataframe). If known, you can pass the total bounds to avoid this
407
+ extra computation.
401
408
level : int (1 - 16), default 16
402
409
Determines the precision of the Morton curve.
403
410
404
411
Returns
405
412
-------
406
413
dask.Series
407
414
Series containing distances along the Morton curve
408
- """
409
415
416
+ """
410
417
# Compute total bounds of all partitions rather than each partition
411
418
if total_bounds is None :
412
- total_bounds = self .total_bounds
419
+ if self .spatial_partitions is not None :
420
+ total_bounds = self .spatial_partitions .total_bounds
421
+ else :
422
+ total_bounds = self .total_bounds
413
423
414
424
# Calculate Morton distances for each partition
415
425
distances = self .map_partitions (
0 commit comments