List of usage examples for com.google.common.geometry S2CellId S2CellId
public S2CellId(long id)
From source file:com.norman0406.slimgress.API.Common.Location.java
public Location(long cellId) { S2CellId cell = new S2CellId(cellId); S2LatLng pos = cell.toLatLng(); latitude = pos.lat().e6(); longitude = pos.lng().e6(); }
From source file:org.esa.beam.occci.S2IEoProduct.java
private static S2CellUnion createS2CellUnion(String cellIdString) { StringTokenizer st = new StringTokenizer(cellIdString, ";"); ArrayList<S2CellId> cellIds = new ArrayList<S2CellId>(); while (st.hasMoreTokens()) { cellIds.add(new S2CellId(Long.parseLong(st.nextToken()))); }/* w w w . j a v a 2 s. c om*/ S2CellUnion cellUnion = new S2CellUnion(); cellUnion.initRawCellIds(cellIds); return cellUnion; }
From source file:org.apache.lucene.spatial.prefix.tree.S2PrefixTreeCell.java
/** * Get the {@link S2CellId} from the {@link BytesRef} representation. * * @param ref The bytes.//from w w w . ja va 2 s . co m * @return the corresponding S2 cell. */ private S2CellId getS2CellIdFromBytesRef(BytesRef ref) { int length = ref.length; if (isLeaf(ref)) { length--; } if (length == 0) { return null; //world cell } int face = PIXELS.get(ref.bytes[ref.offset]); S2CellId cellId = FACES[face]; long id = cellId.id(); for (int i = ref.offset + 1; i < ref.offset + length; i++) { int thisLevel = i - ref.offset; int pos = PIXELS.get(ref.bytes[i]); // first child at level id = id - (id & -id) + (1L << (2 * (S2CellId.MAX_LEVEL - thisLevel * tree.arity))); // next until pos id = id + pos * ((id & -id) << 1); } return new S2CellId(id); }