Skip to content

Latest commit

 

History

History
21 lines (18 loc) · 747 Bytes

README.md

File metadata and controls

21 lines (18 loc) · 747 Bytes

jquad

Java QuadKey Utility

Usage Examples

Creating from coordinates

final Coordinate c = new Coordinate(40.757678, -73.969558);
QuadKey qk = new QuadKey(c, 18); // Zoom level 18 (~ 0.5972 m / pixel)
System.out.println(qk.getAsLong()); // Print 64-bit integer representation: 15104861027
System.out.println(qk.getAsString()); // Print string representation: "032010110132031203"

Checking containment

final Coordinate c1 = new Coordinate(40.757678, -73.969558);
final Coordinate c2 = new Coordinate(40.757608, -73.969436);
QuadKey qk = new QuadKey(c1, 16);
System.out.println(qk.contains(c2)); // true

See tests for further examples.