1. A method comprising: receiving a query for geometry objects within a query distance of a query geometry; generating an in-memory R-tree (IMR-tree) for the query geometry, the IMR-tree comprising a plurality of nodes corresponding to edges of the query geometry; accessing an R-tree index that indexes a plurality of candidate geometries, the R-tree index comprising a plurality of nodes corresponding to minimum bounding geometries; performing a processing step on at least one node of the R-tree index, wherein performing the processing step on a selected node of the R-tree index comprises: generating, based on the query distance, an expanded bounding geometry of a minimum bounding geometry corresponding to the selected node; using the IMR-tree to determine a topological relationship between the expanded bounding geometry and the query geometry; when the expanded bounding geometry intersects the query geometry: determining whether at least one within-distance test applied to the minimum bounding geometry is satisfied; if the at least one within-distance test is satisfied, adding candidate geometries associated with the selected node to a result set; if the at least one within-distance test is not satisfied and the selected node is a non-leaf node of the R-tree index, performing the processing step on at least one child node of the selected node; if the at least one within-distance test is not satisfied and the selected node is a leaf node of the R-tree index: determining whether a within-distance test based on leaf node approximation is satisfied; if said within-distance test based on leaf node approximation is satisfied, adding a candidate geometry associated with the selected node to a result set; wherein the method is performed by one or more computing devices.