final double calculateRMin(double lat, double lon, int paddingTiles) {
        GHPoint query = new GHPoint(lat, lon);
        long key = keyAlgo.encode(query);
        GHPoint center = new GHPoint();
        keyAlgo.decode(key, center);

        // deltaLat and deltaLon comes from the LocationIndex:
        double minLat = center.lat - (0.5 + paddingTiles) * deltaLat;
        double maxLat = center.lat + (0.5 + paddingTiles) * deltaLat;
        double minLon = center.lon - (0.5 + paddingTiles) * deltaLon;
        double maxLon = center.lon + (0.5 + paddingTiles) * deltaLon;

        double dSouthernLat = query.lat - minLat;
        double dNorthernLat = maxLat - query.lat;
        double dWesternLon = query.lon - minLon;
        double dEasternLon = maxLon - query.lon;

        // convert degree deltas into a radius in meter
        double dMinLat, dMinLon;
        if (dSouthernLat < dNorthernLat) {
            dMinLat = distCalc.calcDist(query.lat, query.lon, minLat, query.lon);
        } else {
            dMinLat = distCalc.calcDist(query.lat, query.lon, maxLat, query.lon);
        }

        if (dWesternLon < dEasternLon) {
            dMinLon = distCalc.calcDist(query.lat, query.lon, query.lat, minLon);
        } else {
            dMinLon = distCalc.calcDist(query.lat, query.lon, query.lat, maxLon);
        }

        double rMin = Math.min(dMinLat, dMinLon);
        return rMin;
    }
final double calculateRMin ( double lat , double lon , int paddingTiles ) { GHPoint query = new GHPoint ( lat , lon ) ; long key = keyAlgo . encode ( query ) ; GHPoint center = new GHPoint ( ) ; keyAlgo . decode ( key , center ) ; double minLat = center . lat - ( 0.5 + paddingTiles ) * deltaLat ; double maxLat = center . lat + ( 0.5 + paddingTiles ) * deltaLat ; double minLon = center . lon - ( 0.5 + paddingTiles ) * deltaLon ; double maxLon = center . lon + ( 0.5 + paddingTiles ) * deltaLon ; double dSouthernLat = query . lat - minLat ; double dNorthernLat = maxLat - query . lat ; double dWesternLon = query . lon - minLon ; double dEasternLon = maxLon - query . lon ; double dMinLat , dMinLon ; if ( dSouthernLat < dNorthernLat ) { dMinLat = distCalc . calcDist ( query . lat , query . lon , minLat , query . lon ) ; } else { dMinLat = distCalc . calcDist ( query . lat , query . lon , maxLat , query . lon ) ; } if ( dWesternLon < dEasternLon ) { dMinLon = distCalc . calcDist ( query . lat , query . lon , query . lat , minLon ) ; } else { dMinLon = distCalc . calcDist ( query . lat , query . lon , query . lat , maxLon ) ; } double rMin = Math . min ( dMinLat , dMinLon ) ; return rMin ; }
Calculates the distance to the nearest tile border, where the tile border is the rectangular
region with dimension 2*paddingTiles + 1 and where the center tile contains the given lat/lon
coordinate