Search in sources :

Example 1 with LinearKeyAlgo

use of com.graphhopper.geohash.LinearKeyAlgo in project graphhopper by graphhopper.

the class Location2IDQuadtree method initAlgo.

void initAlgo(int lat, int lon) {
    this.latSize = lat;
    this.lonSize = lon;
    BBox b = graph.getBounds();
    keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b);
    double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon), distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon));
    maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2);
// as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real
// distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0)
}
Also used : BBox(com.graphhopper.util.shapes.BBox) LinearKeyAlgo(com.graphhopper.geohash.LinearKeyAlgo)

Aggregations

LinearKeyAlgo (com.graphhopper.geohash.LinearKeyAlgo)1 BBox (com.graphhopper.util.shapes.BBox)1