Yes, this is basically how range queries work on R-trees: if the rectangle overlaps the query area, expand it (look at the contents, rectangles, or dots). Otherwise, ignore it. The overlap test is simple for a rectangle-rectangle, and for spherical queries you need to calculate the minimum distance of the center of the sphere to the rectangle ("minDist").
k nearest neighbor queries are a bit more complicated; here you need priority queues. Always expand the best candidate (using "minDist") until you find k objects that are closer than the following "minDist" rectangles.
" ", r-tree, .
( , , , SQLite, R-, , , )
R- - , . , (STR), - . R * -trees R- ; , R * -trees, . R *, . R R * .
kd-trees: r-, : -, , . -, ( ), , , . ( ), , . , .