Skip to content

sort Command

For detailed usage and examples, see the Sort User Guide.

Quick Reference

gpio sort --help

This will show all available subcommands and options.

Subcommands

hilbert

Sort by Hilbert space-filling curve for optimal spatial ordering:

gpio sort hilbert input.parquet output.parquet [OPTIONS]

Options:

Option Default Description
-g, --geometry-column auto-detect Geometry column name
--add-bbox - Add bbox column if missing
--compression ZSTD Compression codec (ZSTD, SNAPPY, GZIP, etc.)
--compression-level - Compression level
--row-group-size - Exact row count per group (10k-50k recommended for spatial pushdown)
--row-group-size-mb - Target group size in MB/GB
--geoparquet-version 1.1 Output version: 1.1, 2.0, or parquet-geo-only
--overwrite - Overwrite existing output file
--verbose - Verbose output
--show-sql - Show generated SQL

str

Pack rows with Sort-Tile-Recursive ordering for compact row-group bounding boxes:

gpio sort str input.parquet output.parquet --row-group-size 50000 [OPTIONS]

STR sorts geometry bounding-box centers into X strips, sorts each strip on Y, and alternates the Y direction between strips.

--row-group-size does double duty: it is the writer's row-group target, and it selects how many X strips STR builds, as ceil(sqrt(num_rows / row-group-size)). That is a coarse control - nearby values often produce an identical ordering. STR does not pack rows into row-group-sized tiles, and because the writer rounds row groups up to a multiple of 2048, strips and row groups only line up when --row-group-size is itself a multiple of 2048. Pass an exact row count anyway: without it the writer emits 122,880-row groups while STR sizes its strips from 100,000.

The str subcommand supports the same geometry, bbox, compression, row-group, GeoParquet version, overwrite, verbosity, and SQL-display options as hilbert.

quadkey

Sort by quadkey for spatial locality:

gpio sort quadkey input.parquet output.parquet [OPTIONS]

column

Sort by any column(s):

gpio sort column input.parquet output.parquet COLUMNS [OPTIONS]

Arguments: - COLUMNS - Comma-separated column names to sort by

Options: - --descending - Sort in descending order - --compression - Compression codec - --geoparquet-version - Output GeoParquet version - --overwrite - Overwrite existing output