From 2e7b12e2127249b48a7c6f1504b39fb685492173 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 3 Aug 2016 17:48:24 -0600 Subject: [PATCH] add more of api --- tests/simple.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/tests/simple.js b/tests/simple.js index 6a5a03d..da8445e 100644 --- a/tests/simple.js +++ b/tests/simple.js @@ -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);