in lib/h3core.js [748:761]
export function latLngToCell(lat, lng, res) {
const latLng = C._malloc(SZ_LATLNG);
// Slightly more efficient way to set the memory
C.HEAPF64.set([lat, lng].map(degsToRads), latLng / SZ_DBL);
// Read value as a split long
const h3Index = C._malloc(SZ_H3INDEX);
try {
throwIfError(H3.latLngToCell(latLng, res, h3Index));
return validateH3Index(readH3IndexFromPointer(h3Index));
} finally {
C._free(h3Index);
C._free(latLng);
}
}