gdal icon indicating copy to clipboard operation
gdal copied to clipboard

Add gdal vector sort

Open dbaston opened this issue 1 month ago • 1 comments

Adds a gdal vector sort command to sort features spatially using either a Hilbert curve or a depth-first traversal of an STRtree. Code still needs to be cleaned up but comments on the concept are welcome.

Only argument is --method [hilbert,strtree]. I think we could also have --fields that would be mutually exclusive with --method if a user wants to sort on an attribute instead.

Input parcel dataset, colored on row number:

image

Hilbert-sorted:

image

STRtree-sorted:

image

dbaston avatar Nov 06 '25 18:11 dbaston

Coverage Status

coverage: 71.362% (+0.002%) from 71.36% when pulling 64d2b8479f0399ecdcdea332c3449b7817ba68de on dbaston:gdal-vector-sort into ea75dfb98cb6a6fe27d826f840178e8e6b6fe626 on OSGeo:master.

coveralls avatar Nov 06 '25 22:11 coveralls

The GDAL project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 28 days and is being automatically marked as "stale". If you think this pull request should be merged, please check

  • that all unit tests are passing

  • that all comments by reviewers have been addressed

  • that there is enough information for reviewers, in particular link to any issues which this pull request fixes

  • that you have written unit tests where possible In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request. If there is no further activity on this pull request, it will be closed in 2 weeks.

github-actions[bot] avatar Dec 12 '25 03:12 github-actions[bot]

Using gdal vector sort to create a cloud-optimized shapefile :slightly_smiling_face: of parcels in the Vosges and filtering out the bounding box of Le Vermont:

CPL_CURL_VERBOSE=1 gdal vector filter /vsicurl/http://localhost:8023/parcelles_strtree.shp /tmp/filt.shp --bbox 999000,6186000,1003000,6819000 --overwrite

dataset as-distributed: 1177 HTTP requests Hilbert-sorted: 328 HTTP requests STRtree-sorted: 223 HTTP requests

dbaston avatar Dec 12 '25 18:12 dbaston

cc @calvinmetcalf

dbaston avatar Dec 13 '25 15:12 dbaston

Heck yeah, I'll take a look at it when I'm in the office tommorow.

-Calvin W. Metcalf

On Sat, Dec 13, 2025, 2:30 PM Even Rouault @.***> wrote:

Merged #13351 https://github.com/OSGeo/gdal/pull/13351 into master.

— Reply to this email directly, view it on GitHub https://github.com/OSGeo/gdal/pull/13351#event-21543975617, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAITRH3V6L7RLTBX64M44LT4BRSOZAVCNFSM6AAAAACLLTTVSWVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRRGU2DGOJXGU3DCNY . You are receiving this because you were mentioned.Message ID: @.***>

calvinmetcalf avatar Dec 14 '25 17:12 calvinmetcalf