mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-08-26 17:31:37 +00:00
The old ST_DWithin(50km) scan returned ~226k candidate points near dense areas before sorting (~3-10s/call). Replace with PostGIS k-NN ordering: ORDER BY geom::geography <-> point LIMIT k, which the existing GiST index on (geom::geography) walks nearest-first and stops after K rows. SELECT still computes ST_Distance AS distance_m so callers see real meters. radius_km is kept as a Python soft cap applied after fetch (drops rows beyond it), preserving the caller expanded-radius fallback (now effectively a no-op). 2 tests: SQL contains <-> + LIMIT and no ST_DWithin; radius_km soft cap filters beyond-cap rows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_offroute.py | ||