List of usage examples for com.google.common.geometry S2CellId fromLatLng
public static S2CellId fromLatLng(S2LatLng ll)
From source file:com.bc.inventory.utils.S2Integer.java
public static void main(String[] args) { S2LatLng s2LatLng = S2LatLng.fromDegrees(42, 10); System.out.println("s2LatLng = " + s2LatLng); S2CellId s2CellId = S2CellId.fromLatLng(s2LatLng); System.out.println("s2CellId = " + s2CellId); S2CellId s2CellId13 = s2CellId.parent(13); System.out.println("s2CellId13 = " + s2CellId13); System.out.println("s2cellId = " + Long.toBinaryString(s2CellId.id())); System.out.println("s2cellId13 = " + Long.toBinaryString(s2CellId13.id())); System.out.println("s2cellIdInt = " + Long.toBinaryString(asInt(s2CellId))); }
From source file:org.apache.lucene.spatial.prefix.tree.S2PrefixTree.java
@Override public CellIterator getTreeCellIterator(Shape shape, int detailLevel) { if (!(shape instanceof Point)) { return super.getTreeCellIterator(shape, detailLevel); }/*from w ww . ja v a2 s .c o m*/ Point p = (Point) shape; S2CellId id = S2CellId.fromLatLng(S2LatLng.fromDegrees(p.getY(), p.getX())) .parent(arity * (detailLevel - 1)); List<Cell> cells = new ArrayList<>(detailLevel); for (int i = 0; i < detailLevel - 1; i++) { cells.add(new S2PrefixTreeCell(this, id.parent(i * arity))); } cells.add(new S2PrefixTreeCell(this, id)); return new FilterCellIterator(cells.iterator(), null); }