Example usage for com.google.common.geometry S2CellId fromFacePosLevel

List of usage examples for com.google.common.geometry S2CellId fromFacePosLevel

Introduction

In this page you can find the example usage for com.google.common.geometry S2CellId fromFacePosLevel.

Prototype

public static S2CellId fromFacePosLevel(int face, long pos, int level) 

Source Link

Document

Return a cell given its face (range 0..5), 61-bit Hilbert curve position within that face, and level (range 0..MAX_LEVEL).

Usage

From source file:org.geosde.cassandra.GeometryTestCase.java

/**
 * Return a random cell id at the given level or at a randomly chosen level.
 * The distribution is uniform over the space of cell ids, but only
 * approximately uniform over the surface of the sphere.
 *///w ww.  j av a2 s  . c om
public S2CellId getRandomCellId(int level) {
    int face = random(S2CellId.NUM_FACES);
    long pos = rand.nextLong() & ((1L << (2 * S2CellId.MAX_LEVEL)) - 1);
    return S2CellId.fromFacePosLevel(face, pos, level);
}