add more of api

This commit is contained in:
AJ ONeal 2016-08-03 17:48:24 -06:00
parent 1a9c95e2c6
commit 2e7b12e212
1 changed files with 30 additions and 3 deletions

View File

@ -6,19 +6,46 @@ var lat = 40.2574448;
var lng = -111.7089464;
var level = 15;
//
// Convert from Lat / Lng
//
var key = S2.latLngToKey(lat, lng, level);
// '4/032212303102210'
console.log(key);
// '4/032212303102210'
//
// Convert between Hilbert Curve Quadtree Key and S2 Cell Id
//
var id = S2.keyToId(key);
// '9749618446378729472'
console.log(id);
// '9749618446378729472'
var key = S2.idToKey(id);
console.log(key);
// '9749618446378729472'
//
// Neighbors
//
var neighbors = S2.latLngToNeighborKeys(lat, lng, level);
// [ keyLeft, keyDown, keyRight, keyUp ]
console.log(neighbors);
// [ keyLeft, keyDown, keyRight, keyUp ]
//
// Previous, Next, and Step
//
var nextKey = S2.nextKey(key);
console.log(nextKey);
var prevKey = S2.prevKey(key);
console.log(prevKey);
var backTenKeys = S2.stepKey(key, -10);
console.log(backTenKeys);