.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "GDAL-VECTOR-SORT" "1" "May 08, 2026" "" "GDAL" .SH NAME gdal-vector-sort \- Spatially sort a vector dataset .sp Added in version 3.13. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX Usage: gdal vector sort [OPTIONS] Spatially order the features in a layer Positional arguments: \-i, \-\-input Input vector datasets [required] [not available in pipelines] \-o, \-\-output Output vector dataset [required] [not available in pipelines] Common Options: \-h, \-\-help Display help message and exit \-\-json\-usage Display usage as JSON document and exit \-\-config = Configuration option [may be repeated] \-q, \-\-quiet Quiet mode (no progress bar or warning message) [not available in pipelines] Options: \-l, \-\-layer, \-\-input\-layer Input layer name(s) [may be repeated] [not available in pipelines] \-f, \-\-of, \-\-format, \-\-output\-format Output format (\(dqGDALG\(dq allowed) [not available in pipelines] \-\-co, \-\-creation\-option = Creation option [may be repeated] [not available in pipelines] \-\-lco, \-\-layer\-creation\-option = Layer creation option [may be repeated] [not available in pipelines] \-\-overwrite Whether overwriting existing output dataset is allowed [not available in pipelines] \-\-update Whether to open existing dataset in update mode [not available in pipelines] \-\-overwrite\-layer Whether overwriting existing output layer is allowed [not available in pipelines] \-\-append Whether appending to existing layer is allowed [not available in pipelines] Mutually exclusive with \-\-upsert \-\-output\-layer Output layer name [not available in pipelines] \-\-skip\-errors Skip errors when writing features [not available in pipelines] \-\-geometry\-field Name of geometry field to use in sort \-\-method Geometry sorting algorithm. METHOD=hilbert|strtree (default: hilbert) \-\-use\-tempfile Write features to a temporary file to avoid reading the entire input dataset into memory Advanced Options: \-\-if, \-\-input\-format Input formats [may be repeated] [not available in pipelines] \-\-oo, \-\-open\-option = Open options [may be repeated] [not available in pipelines] \-\-output\-oo, \-\-output\-open\-option = Output open options [may be repeated] [not available in pipelines] \-\-upsert Upsert features (implies \(aqappend\(aq) [not available in pipelines] Mutually exclusive with \-\-append .EE .UNINDENT .UNINDENT .SH DESCRIPTION .sp \fBgdal vector sort\fP sorts the features in a vector dataset according to the position of its geometries. The sorting method can be specified via \fI\%\-\-method\fP, with Hilbert and Sort\-Tile\-Recursive (STRTree) algorithms available. .sp Features that have null or empty geometries will be placed at the end of the sorted dataset. .sp This command can also be used as a step of \fI\%gdal vector pipeline\fP\&. .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 Use of the STRtree algorithm requires a GDAL build against the GEOS library. .UNINDENT .UNINDENT .SH PROGRAM-SPECIFIC OPTIONS .INDENT 0.0 .TP .B \-\-geometry\-field The name of the geometry field by which features should be sorted. .UNINDENT .INDENT 0.0 .TP .B \-\-method Specifies the sorting method. Available options are: .INDENT 7.0 .IP \(bu 2 hilbert : default method. Geometries are sorted according to the Hilbert code of the center point of their bounding box .IP \(bu 2 strtree : Geometries are sorted by constructing a sort\-tile\-recursive tree using the GEOS library and performing a depth\-first iteration. .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \-\-use\-tempfile Write the input features to a temporary file from which they can be read in sorted order. Avoids the need to load the entire input layer into memory. .UNINDENT .SH RETURN STATUS CODE .sp The program returns status code 0 in case of success, and non\-zero in case of error (non\-blocking errors emitted as warnings are considered as a successful execution). .SH EXAMPLES .SS Example 1: Create a cloud\-optimized Shapefile .INDENT 0.0 .INDENT 3.5 .sp .EX $ gdal vector sort in.gpkg out.shp \-\-method hilbert \-\-lco SPATIAL_INDEX=YES .EE .UNINDENT .UNINDENT .SH AUTHOR Dan Baston .SH COPYRIGHT 1998-2026 .\" Generated by docutils manpage writer. .