I am just starting out with Uber's h3geo (JavaScript), and am getting half the number of indexes at every resolution than what the docs suggest.
const nw = [-180, 90];
const ne = [ 180, 90];
const se = [ 180, -90];
const sw = [-180, -90];
let rect = [nw, ne, se, sw];
const res = 0;
const grid = h3.polyfill(rect, res);
console.log(grid.length);
// res 0 output → 61, should output 122
// res 1 output → 421, should 842
// res 2 output → 2951, should 5882
// res 3 output → 20580; should output 41162
// and so on
What am I doing wrong?
Additionally, the h3geo
docs for regions show lat
first and lng
second. As shown above, I am using [lng, lat]
. If I flip them, I consistently get grid.length
as 0. And if I give a geoJson, I get an error saying coordinates don't have a length property
. What am I missing?