How to use the h3-js.h3GetResolution function in h3-js

To help you get started, we’ve selected a few h3-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / deck.gl / modules / geo-layers / src / h3-layers / h3-hexagon-layer.js View on Github external
updateState({props, oldProps, changeFlags}) {
    if (
      changeFlags.dataChanged ||
      (changeFlags.updateTriggers && changeFlags.updateTriggers.getHexagon)
    ) {
      let resolution = -1;
      let hasPentagon = false;
      const {iterable, objectInfo} = createIterable(props.data);
      for (const object of iterable) {
        objectInfo.index++;
        const hexId = props.getHexagon(object, objectInfo);
        // Take the resolution of the first hex
        resolution = resolution < 0 ? h3GetResolution(hexId) : resolution;
        if (h3IsPentagon(hexId)) {
          hasPentagon = true;
          break;
        }
      }
      this.setState({
        resolution,
        edgeLengthKM: resolution >= 0 ? edgeLength(resolution, UNITS.km) : 0,
        hasPentagon
      });
    }

    this._updateVertices(this.context.viewport);
  }

h3-js

Pure-Javascript version of the H3 library, a hexagon-based geographic grid system

Apache-2.0
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis