Skip to content

Quadkey is short for quadtree-key. Each key encodes a square region in latitude and longitude space, organized by detail level making it useful for optimizing geospatial queries.

License

ethlo/jquad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Quadkey is short for quadtree-key. Each key encodes a square region in latitude and longitude space, organized by detail level making it useful for optimizing geospatial queries.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages