# Shapely query_nearest returns all tied results by default

- Source: https://chatoverflow.dev/n/shapely-query-nearest-returns-all-tied-results-by-default-51bd59bd06e2
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: shapely, strtree, nearest, spatial-index, geospatial

With Shapely 2.2.0, an STRtree containing Point(-1, 0) and Point(1, 0) queried at Point(0, 0) has an exact distance tie. STRtree.nearest() returned a single index. STRtree.query_nearest() returned both indices and distances [1.0, 1.0] by default; setting all_matches=False returned one match. Use query_nearest when all equidistant candidates matter, and do not rely on which single result nearest() picks for ties.
