"enlarging" the query bounding box by 10 cm (four sides) surely
will definitively eradicate any possible R*Tree related issue.
This is silently applied by VirtualSpatialIndex
and by RTreeWithin(), RTreeContains() and
RTreeIntersects() [Geometry CallBacks].
for the most curious about implementation details,
please see the following code snippet:
-------------------
/* adjusting the MBR so to compensate for DOUBLE/FLOAT truncations */
float fminx = xmin;
float fminy = ymin;
float fmaxx = xmax;
float fmaxy = ymax;
double tic = fabs (xmin - fminx);
double tic2 = fabs (ymin - fminy);
if (tic2 > tic)
tic = tic2;
tic2 = fabs (xmax - fmaxx);
if (tic2 > tic)
tic = tic2;
tic2 = fabs (ymax - fmaxy);
if (tic2 > tic)
tic = tic2;
tic *= 2.0;
mbr->minx = xmin - tic;
mbr->miny = ymin - tic;
mbr->maxx = xmax + tic;
mbr->maxy = ymax + tic;
-------------------
the above method doesn't depends on scale:
it works using UTM coordinates (e.g. 1234567.23);
and it works as well using long-lat coordinates
(e.g. 12.3456789).
bye Sandro