Skip to main content
Calculate the distance along a Hilbert curve. Distances are calculated from geometry-envelope midpoints and can be used to spatially order a GeoSeries or GeoDataFrame by mapping its two-dimensional geometries onto a one-dimensional curve.

Signature

Parameters

4-element array-like
default:"None"
The spatial extent in which the curve is constructed, used to rescale geometry midpoints. By default, the extent of all geometry-envelope midpoints is computed. Passing known bounds avoids that metadata computation.
int
default:"16"
Determines the precision of the curve. Documented levels are 1 through 16, with grid coordinates in the range [0, 2**level - 1].

Returns

pandas-on-Spark Series
Distributed Series named "hilbert_distance". Spark stores the unsigned 32-bit Hilbert values as signed 64-bit integers.
The method performs one eager distributed validation and metadata aggregation. Geometry rows and the returned values remain distributed; no geometry data are collected on the driver.

Examples