experimentalLocalIjToH3 method

  1. @override
BigInt experimentalLocalIjToH3(
  1. BigInt origin,
  2. CoordIJ coordinates
)
override

Produces an H3 index for IJ coordinates anchored by an origin.

  • The coordinate space used by this function may have deleted regions or warping due to pentagonal distortion.
  • Coordinates are only comparable if they come from the same origin index.
  • Failure may occur if the index is too far away from the origin or if the index is on the other side of a pentagon.
  • This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.

Implementation

@override
BigInt experimentalLocalIjToH3(BigInt origin, CoordIJ coordinates) {
  return using((arena) {
    final out = arena<Uint64>();
    final resultCode = _h3c.experimentalLocalIjToH3(
      origin.toInt(),
      coordinates.toNative(arena),
      out,
    );
    if (resultCode != 0) {
      throw H3Exception(
        'Index not defined for this origin and IJ coordinates pair. '
        'IJ coordinates may be too far from origin, or '
        'a pentagon distortion was encountered.',
      );
    }
    return out.value.toBigInt();
  });
}