Search Shortcut cmd + k | ctrl + k
lindel

Linearization/Delinearization, Z-Order, Hilbert and Morton Curves

Maintainer(s): rustyconover

Compatibility Matrix

This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.

Platform 1.4.4 1.4.5 1.5.5 1.5.6 2.0.0
Linux AMD64
Linux ARM64
macOS AMD64
macOS ARM64
Windows AMD64
Windows ARM64
WebAssembly

Installing and Loading

INSTALL lindel FROM community;
LOAD lindel;

About lindel

For more information regarding usage, see the documentation.

Added Functions

function_name function_type description comment examples
hilbert_decode scalar Decodes a Hilbert-encoded unsigned integer back into an array of values. The number of output elements and their type are determined by the parameters. Keep the encoded key unsigned; return_unsigned selects signed or unsigned integer coordinates. NULL [hilbert_decode(123::UBIGINT, 2, false, true), hilbert_decode(hilbert_encode([-1]::INTEGER[1]), 1, false, false)]
hilbert_encode scalar Encodes an array of integers or floats into a single unsigned integer using Hilbert curve mapping. Hilbert curves preserve locality better than Morton encoding, making them ideal for spatial indexing. NULL [hilbert_encode([1, 2, 3]::INTEGER[3])]
morton_decode scalar Decodes a Morton (Z-order) encoded unsigned integer back into an array of values. The number of output elements and their type are determined by the parameters. Keep the encoded key unsigned; return_unsigned selects signed or unsigned integer coordinates. NULL [morton_decode(123::UBIGINT, 2, false, true), morton_decode(morton_encode([-1]::INTEGER[1]), 1, false, false)]
morton_encode scalar Encodes an array of integers or floats into a single unsigned integer using Morton (Z-order) curve mapping. Morton encoding interleaves bits and is computationally simpler than Hilbert encoding. NULL [morton_encode([1, 2, 3]::INTEGER[3])]

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

This extension does not add any settings.