dask_geopandas.GeoSeries.morton_distance#

GeoSeries.morton_distance(total_bounds=None, level=16)#

Calculate the distance of geometries along the Morton curve

The Morton curve is also known as Z-order https://en.wikipedia.org/wiki/Z-order.

The Morton distance can be used to spatially partition Dask-GeoPandas objects, by mapping two-dimensional geometries along the Morton space-filing curve.

Each geometry is represented by the midpoint of its bounds and linked to the Morton curve. The function returns a distance from the beginning of the curve to the linked point.

Morton distance is more performant than hilbert_distance but can result in less optimal partitioning.

Parameters:
total_bounds4-element array, optional

The spatial extent in which the curve is constructed (used to rescale the geometry midpoints). By default, the total bounds of the full dask GeoDataFrame will be computed (from the spatial partitions, if available, otherwise computed from the full dataframe). If known, you can pass the total bounds to avoid this extra computation.

levelint (1 - 16), default 16

Determines the precision of the Morton curve.

Returns:
dask.Series

Series containing distances along the Morton curve