Hello @vfa and welcome!
- Bindings are not available in v10. Bindings will be replaced with Computed Fields defined directly on the Collections, rather than indexes. However, we’ve not launched Computed Fields yet. In the mean time, any values you want to index on must be calculated and written to the documents within your own queries.
- Translating the h3 hash function into v10 should make it MUCH clearer. The biggest thing is that FQL v10 has bitwise operators !!
updating the Put it all together section could be done like this
let getH3parents = (h3) => {
// Define constants
let RMASK = 67553994410557440
let RCLEAR = 9155818042444218367
let PARENT_CONSTS = [
[63050394783186944, 7],
[58546795155816448, 63],
[54043195528445952, 511],
[49539595901075456, 4095],
[45035996273704960, 32767],
[40532396646334464, 262143],
[36028797018963968, 2097151],
[31525197391593472, 16777215],
[27021597764222976, 134217727],
[22517998136852480, 1073741823],
[18014398509481984, 8589934591],
[13510798882111488, 68719476735],
[9007199254740992, 549755813887],
[4503599627370496, 4398046511103],
[0, 35184372088831],
]
// Filter the table
let current_res = h3 & RMASK
let parent_consts_filtered = PARENT_CONSTS.where(c => c[0] < current_res)
// Calculate the parent indexes
let h3_nores = h3 & RCLEAR
let parents = parent_consts_filtered.map(c => {
let res = c[0]
let fill = c[1]
h3_nores | res | fill
})
parents
}
// calculate for mock document
let doc = { h3: 644722037633318912 }
getH3parents(doc.h3)
For #3, I’m not familiar with the h3-js library and respective functions polygonToCells, compactCells, etc. Does this FQL v10 lambda help you out?