Class H3CoreV3

java.lang.Object
com.uber.h3core.H3CoreV3

public class H3CoreV3
extends java.lang.Object
H3CoreV3 provides all functions of the H3 API with backwards compatible naming for the V3 API.

This class is thread safe and can be used as a singleton. It is implemented on top of H3Core.

Specific exceptions thrown may not be the same as V3.

This class will be removed in a future version of H3-Java.

  • Method Summary

    Modifier and Type Method Description
    double cellArea​(long h3, AreaUnit unit)
    Calculates the area of the given H3 cell.
    double cellArea​(java.lang.String h3Address, AreaUnit unit)
    Calculates the area of the given H3 cell.
    java.util.List<java.lang.Long> compact​(java.util.Collection<java.lang.Long> h3)
    Returns a compacted set of indexes, at possibly coarser resolutions.
    java.util.List<java.lang.String> compactAddress​(java.util.Collection<java.lang.String> h3Addresses)
    Returns a compacted set of indexes, at possibly coarser resolutions.
    double edgeLength​(int res, LengthUnit unit)
    Returns the average edge length in unit for indexes at resolution res .
    double exactEdgeLength​(long edge, LengthUnit unit)
    Calculate the edge length of the given H3 edge.
    double exactEdgeLength​(java.lang.String edgeAddress, LengthUnit unit)
    Calculate the edge length of the given H3 edge.
    CoordIJ experimentalH3ToLocalIj​(long origin, long h3)
    Converts h3 to IJ coordinates in a local coordinate space defined by origin .
    CoordIJ experimentalH3ToLocalIj​(java.lang.String originAddress, java.lang.String h3Address)
    Converts h3Address to IJ coordinates in a local coordinate space defined by originAddress.
    long experimentalLocalIjToH3​(long origin, CoordIJ ij)
    Converts the IJ coordinates to an index, using a local IJ coordinate space anchored by origin.
    java.lang.String experimentalLocalIjToH3​(java.lang.String originAddress, CoordIJ ij)
    Converts the IJ coordinates to an index, using a local IJ coordinate space anchored by origin.
    long geoToH3​(double lat, double lng, int res)
    Find the H3 index of the resolution res cell containing the lat/lon (in degrees)
    java.lang.String geoToH3Address​(double lat, double lng, int res)
    Find the H3 index of the resolution res cell containing the lat/lon (in degrees)
    long getDestinationH3IndexFromUnidirectionalEdge​(long h3)
    Returns the destination index of the given unidirectional edge.
    java.lang.String getDestinationH3IndexFromUnidirectionalEdge​(java.lang.String h3)
    Returns the destination index of the given unidirectional edge.
    java.util.List<java.lang.Long> getH3IndexesFromUnidirectionalEdge​(long h3)
    Returns the origin and destination indexes (in that order) of the given unidirectional edge.
    java.util.List<java.lang.String> getH3IndexesFromUnidirectionalEdge​(java.lang.String h3)
    Returns the origin and destination indexes (in that order) of the given unidirectional edge.
    long getH3UnidirectionalEdge​(long a, long b)
    Returns a unidirectional edge index representing a towards b.
    java.lang.String getH3UnidirectionalEdge​(java.lang.String a, java.lang.String b)
    Returns a unidirectional edge index representing a towards b.
    java.util.List<LatLng> getH3UnidirectionalEdgeBoundary​(long h3)
    Returns a list of coordinates representing the given edge.
    java.util.List<LatLng> getH3UnidirectionalEdgeBoundary​(java.lang.String h3)
    Returns a list of coordinates representing the given edge.
    java.util.List<java.lang.Long> getH3UnidirectionalEdgesFromHexagon​(long h3)
    Returns all unidirectional edges originating from the given index.
    java.util.List<java.lang.String> getH3UnidirectionalEdgesFromHexagon​(java.lang.String h3)
    Returns all unidirectional edges originating from the given index.
    long getOriginH3IndexFromUnidirectionalEdge​(long h3)
    Returns the origin index of the given unidirectional edge.
    java.lang.String getOriginH3IndexFromUnidirectionalEdge​(java.lang.String h3)
    Returns the origin index of the given unidirectional edge.
    java.util.Collection<java.lang.Long> getPentagonIndexes​(int res)
    Returns a collection of all topologically pentagonal cells at the given resolution.
    java.util.Collection<java.lang.String> getPentagonIndexesAddresses​(int res)
    Returns a collection of all topologically pentagonal cells at the given resolution.
    java.util.Collection<java.lang.Long> getRes0Indexes()
    Returns a collection of all base cells (H3 indexes are resolution 0).
    java.util.Collection<java.lang.String> getRes0IndexesAddresses()
    Returns a collection of all base cells (H3 indexes are resolution 0).
    java.util.List<java.util.List<java.util.List<LatLng>>> h3AddressSetToMultiPolygon​(java.util.Collection<java.lang.String> h3Addresses, boolean geoJson)
    Create polygons from a set of contiguous indexes
    int h3Distance​(long a, long b)
    Returns the distance between a and b.
    int h3Distance​(java.lang.String a, java.lang.String b)
    Returns the distance between a and b.
    int h3GetBaseCell​(long h3)
    Returns the base cell number for this index.
    int h3GetBaseCell​(java.lang.String h3Address)
    Returns the base cell number for this index.
    java.util.Collection<java.lang.Integer> h3GetFaces​(long h3)
    Find all icosahedron faces intersected by a given H3 index, represented as integers from 0-19.
    java.util.Collection<java.lang.Integer> h3GetFaces​(java.lang.String h3)
    Find all icosahedron faces intersected by a given H3 index, represented as integers from 0-19.
    int h3GetResolution​(long h3)
    Returns the resolution of the provided index
    int h3GetResolution​(java.lang.String h3Address)
    Returns the resolution of the provided index
    boolean h3IndexesAreNeighbors​(long a, long b)
    Returns true if the two indexes are neighbors.
    boolean h3IndexesAreNeighbors​(java.lang.String a, java.lang.String b)
    Returns true if the two indexes are neighbors.
    boolean h3IsPentagon​(long h3)
    Returns true if this index is one of twelve pentagons per resolution.
    boolean h3IsPentagon​(java.lang.String h3Address)
    Returns true if this index is one of twelve pentagons per resolution.
    boolean h3IsResClassIII​(long h3)
    Determines if an index is Class III or Class II.
    boolean h3IsResClassIII​(java.lang.String h3Address)
    Determines if an index is Class III or Class II.
    boolean h3IsValid​(long h3)
    Returns true if this is a valid H3 index.
    boolean h3IsValid​(java.lang.String h3Address)
    Returns true if this is a valid H3 index.
    java.util.List<java.lang.Long> h3Line​(long start, long end)
    Given two H3 indexes, return the line of indexes between them (inclusive of endpoints).
    java.util.List<java.lang.String> h3Line​(java.lang.String startAddress, java.lang.String endAddress)
    Given two H3 indexes, return the line of indexes between them (inclusive of endpoints).
    java.util.List<java.util.List<java.util.List<LatLng>>> h3SetToMultiPolygon​(java.util.Collection<java.lang.Long> h3, boolean geoJson)
    Create polygons from a set of contiguous indexes
    long h3ToCenterChild​(long h3, int childRes)
    Returns the center child at the given resolution.
    java.lang.String h3ToCenterChild​(java.lang.String h3, int childRes)
    Returns the center child at the given resolution.
    java.util.List<java.lang.Long> h3ToChildren​(long h3, int childRes)
    Provides the children of the index at the given resolution.
    java.util.List<java.lang.String> h3ToChildren​(java.lang.String h3Address, int childRes)
    Provides the children of the index at the given resolution.
    LatLng h3ToGeo​(long h3)
    Find the latitude, longitude (both in degrees) center point of the cell.
    LatLng h3ToGeo​(java.lang.String h3Address)
    Find the latitude, longitude (degrees) center point of the cell.
    java.util.List<LatLng> h3ToGeoBoundary​(long h3)
    Find the cell boundary in latitude, longitude (degrees) coordinates for the cell
    java.util.List<LatLng> h3ToGeoBoundary​(java.lang.String h3Address)
    Find the cell boundary in latitude, longitude (degrees) coordinates for the cell
    long h3ToParent​(long h3, int res)
    Returns the parent of the index at the given resolution.
    java.lang.String h3ToParentAddress​(java.lang.String h3Address, int res)
    Returns the parent of the index at the given resolution.
    java.lang.String h3ToString​(long h3)
    Converts from long representation of an index to String representation.
    boolean h3UnidirectionalEdgeIsValid​(long h3)
    Returns true if the given index is a valid unidirectional edge.
    boolean h3UnidirectionalEdgeIsValid​(java.lang.String h3)
    Returns true if the given index is a valid unidirectional edge.
    double hexArea​(int res, AreaUnit unit)
    Returns the average area in unit for indexes at resolution res.
    java.util.List<java.util.List<java.lang.Long>> hexRange​(long h3, int k)
    Returns in order neighbor traversal.
    java.util.List<java.util.List<java.lang.String>> hexRange​(java.lang.String h3Address, int k)
    Returns in order neighbor traversal.
    java.util.List<java.lang.Long> hexRing​(long h3, int k)
    Returns in order neighbor traversal, of indexes with distance of k.
    java.util.List<java.lang.String> hexRing​(java.lang.String h3Address, int k)
    Returns in order neighbor traversal, of indexes with distance of k.
    java.util.List<java.lang.Long> kRing​(long h3, int k)
    Neighboring indexes in all directions.
    java.util.List<java.lang.String> kRing​(java.lang.String h3Address, int k)
    Neighboring indexes in all directions.
    java.util.List<java.util.List<java.lang.Long>> kRingDistances​(long h3, int k)
    Neighboring indexes in all directions, ordered by distance from the origin index.
    java.util.List<java.util.List<java.lang.String>> kRingDistances​(java.lang.String h3Address, int k)
    Neighboring indexes in all directions, ordered by distance from the origin index.
    java.util.List<java.util.List<java.lang.String>> kRings​(java.lang.String h3Address, int k)
    Neighboring indexes in all directions.
    static H3CoreV3 newInstance()
    Create by unpacking the H3 native library to disk and loading it.
    static H3CoreV3 newInstance​(H3CoreLoader.OperatingSystem os, java.lang.String arch)
    Create by unpacking the H3 native library to disk and loading it.
    static H3CoreV3 newSystemInstance()
    Create by using the H3 native library already installed on the system.
    long numHexagons​(int res)
    Returns the number of unique H3 indexes at resolution res.
    double pointDist​(LatLng a, LatLng b, LengthUnit unit)
    Return the distance along the sphere between two points.
    java.util.List<java.lang.Long> polyfill​(java.util.List<LatLng> points, java.util.List<java.util.List<LatLng>> holes, int res)
    Finds indexes within the given geofence.
    java.util.List<java.lang.String> polyfillAddress​(java.util.List<LatLng> points, java.util.List<java.util.List<LatLng>> holes, int res)
    Finds indexes within the given geofence.
    long stringToH3​(java.lang.String h3Address)
    Converts from String representation of an index to long representation.
    java.util.List<java.lang.Long> uncompact​(java.util.Collection<java.lang.Long> h3, int res)
    Uncompacts all the given indexes to resolution res.
    java.util.List<java.lang.String> uncompactAddress​(java.util.Collection<java.lang.String> h3Addresses, int res)
    Uncompacts all the given indexes to resolution res.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • newInstance

      public static H3CoreV3 newInstance() throws java.io.IOException
      Create by unpacking the H3 native library to disk and loading it. The library will attempt to detect the correct operating system and architecture of native library to unpack.
      Throws:
      java.lang.SecurityException - Loading the library was not allowed by the SecurityManager.
      java.lang.UnsatisfiedLinkError - The library could not be loaded
      java.io.IOException - The library could not be extracted to disk.
    • newInstance

      public static H3CoreV3 newInstance​(H3CoreLoader.OperatingSystem os, java.lang.String arch) throws java.io.IOException
      Create by unpacking the H3 native library to disk and loading it. The library will attempt to extract the native library matching the given arguments to disk.
      Throws:
      java.lang.SecurityException - Loading the library was not allowed by the SecurityManager.
      java.lang.UnsatisfiedLinkError - The library could not be loaded
      java.io.IOException - The library could not be extracted to disk.
    • newSystemInstance

      public static H3CoreV3 newSystemInstance()
      Create by using the H3 native library already installed on the system.
      Throws:
      java.lang.SecurityException - The library could not be loaded
      java.lang.UnsatisfiedLinkError - The library could not be loaded
    • h3IsValid

      public boolean h3IsValid​(long h3)
      Returns true if this is a valid H3 index.
    • h3IsValid

      public boolean h3IsValid​(java.lang.String h3Address)
      Returns true if this is a valid H3 index.
    • h3GetBaseCell

      public int h3GetBaseCell​(long h3)
      Returns the base cell number for this index.
    • h3GetBaseCell

      public int h3GetBaseCell​(java.lang.String h3Address)
      Returns the base cell number for this index.
    • h3IsPentagon

      public boolean h3IsPentagon​(long h3)
      Returns true if this index is one of twelve pentagons per resolution.
    • h3IsPentagon

      public boolean h3IsPentagon​(java.lang.String h3Address)
      Returns true if this index is one of twelve pentagons per resolution.
    • geoToH3

      public long geoToH3​(double lat, double lng, int res)
      Find the H3 index of the resolution res cell containing the lat/lon (in degrees)
      Parameters:
      lat - Latitude in degrees.
      lng - Longitude in degrees.
      res - Resolution, 0 <= res <= 15
      Returns:
      The H3 index.
    • geoToH3Address

      public java.lang.String geoToH3Address​(double lat, double lng, int res)
      Find the H3 index of the resolution res cell containing the lat/lon (in degrees)
      Parameters:
      lat - Latitude in degrees.
      lng - Longitude in degrees.
      res - Resolution, 0 <= res <= 15
      Returns:
      The H3 index.
    • h3ToGeo

      public LatLng h3ToGeo​(long h3)
      Find the latitude, longitude (both in degrees) center point of the cell.
    • h3ToGeo

      public LatLng h3ToGeo​(java.lang.String h3Address)
      Find the latitude, longitude (degrees) center point of the cell.
    • h3ToGeoBoundary

      public java.util.List<LatLng> h3ToGeoBoundary​(long h3)
      Find the cell boundary in latitude, longitude (degrees) coordinates for the cell
    • h3ToGeoBoundary

      public java.util.List<LatLng> h3ToGeoBoundary​(java.lang.String h3Address)
      Find the cell boundary in latitude, longitude (degrees) coordinates for the cell
    • kRing

      public java.util.List<java.lang.String> kRing​(java.lang.String h3Address, int k)
      Neighboring indexes in all directions.
      Parameters:
      h3Address - Origin index
      k - Number of rings around the origin
    • kRings

      public java.util.List<java.util.List<java.lang.String>> kRings​(java.lang.String h3Address, int k)
      Neighboring indexes in all directions.
      Parameters:
      h3Address - Origin index
      k - Number of rings around the origin
      Returns:
      List of kRing(String, int) results.
    • kRing

      public java.util.List<java.lang.Long> kRing​(long h3, int k)
      Neighboring indexes in all directions.
      Parameters:
      h3 - Origin index
      k - Number of rings around the origin
    • kRingDistances

      public java.util.List<java.util.List<java.lang.String>> kRingDistances​(java.lang.String h3Address, int k)
      Neighboring indexes in all directions, ordered by distance from the origin index.
      Parameters:
      h3Address - Origin index
      k - Number of rings around the origin
      Returns:
      A list of rings, each of which is a list of addresses. The rings are in order from closest to origin to farthest.
    • kRingDistances

      public java.util.List<java.util.List<java.lang.Long>> kRingDistances​(long h3, int k)
      Neighboring indexes in all directions, ordered by distance from the origin index.
      Parameters:
      h3 - Origin index
      k - Number of rings around the origin
      Returns:
      A list of rings, each of which is a list of addresses. The rings are in order from closest to origin to farthest.
    • hexRange

      public java.util.List<java.util.List<java.lang.String>> hexRange​(java.lang.String h3Address, int k)
      Returns in order neighbor traversal.
      Parameters:
      h3Address - Origin hexagon index
      k - Number of rings around the origin
      Returns:
      A list of rings, each of which is a list of addresses. The rings are in order from closest to origin to farthest.
    • hexRange

      public java.util.List<java.util.List<java.lang.Long>> hexRange​(long h3, int k)
      Returns in order neighbor traversal.
      Parameters:
      h3 - Origin hexagon index
      k - Number of rings around the origin
      Returns:
      A list of rings, each of which is a list of addresses. The rings are in order from closest to origin to farthest.
    • hexRing

      public java.util.List<java.lang.String> hexRing​(java.lang.String h3Address, int k)
      Returns in order neighbor traversal, of indexes with distance of k.
      Parameters:
      h3Address - Origin index
      k - Number of rings around the origin
      Returns:
      All indexes k away from the origin
    • hexRing

      public java.util.List<java.lang.Long> hexRing​(long h3, int k)
      Returns in order neighbor traversal, of indexes with distance of k.
      Parameters:
      h3 - Origin index
      k - Number of rings around the origin
      Returns:
      All indexes k away from the origin
    • h3Distance

      public int h3Distance​(java.lang.String a, java.lang.String b)
      Returns the distance between a and b. This is the grid distance, or distance expressed in number of H3 cells.

      In some cases H3 cannot compute the distance between two indexes. This can happen because:

      • The indexes are not comparable (difference resolutions, etc)
      • The distance is greater than the H3 core library supports
      • The H3 library does not support finding the distance between the two cells, because of pentagonal distortion.
      Parameters:
      a - An H3 index
      b - Another H3 index
      Returns:
      Distance between the two in grid cells
    • h3Distance

      public int h3Distance​(long a, long b)
      Returns the distance between a and b. This is the grid distance, or distance expressed in number of H3 cells.

      In some cases H3 cannot compute the distance between two indexes. This can happen because:

      • The indexes are not comparable (difference resolutions, etc)
      • The distance is greater than the H3 core library supports
      • The H3 library does not support finding the distance between the two cells, because of pentagonal distortion.
      Parameters:
      a - An H3 index
      b - Another H3 index
      Returns:
      Distance between the two in grid cells
    • experimentalH3ToLocalIj

      public CoordIJ experimentalH3ToLocalIj​(long origin, long h3)
      Converts h3 to IJ coordinates in a local coordinate space defined by origin .

      The local IJ coordinate space may have deleted regions and warping due to pentagon distortion. IJ coordinates are only comparable if they came from the same origin.

      This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.

      Parameters:
      origin - Anchoring index for the local coordinate space.
      h3 - Index to find the coordinates of.
      Returns:
      Coordinates for h3 in the local coordinate space.
    • experimentalH3ToLocalIj

      public CoordIJ experimentalH3ToLocalIj​(java.lang.String originAddress, java.lang.String h3Address)
      Converts h3Address to IJ coordinates in a local coordinate space defined by originAddress.

      The local IJ coordinate space may have deleted regions and warping due to pentagon distortion. IJ coordinates are only comparable if they came from the same origin.

      This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.

      Parameters:
      originAddress - Anchoring index for the local coordinate space.
      h3Address - Index to find the coordinates of.
      Returns:
      Coordinates for h3 in the local coordinate space.
    • experimentalLocalIjToH3

      public long experimentalLocalIjToH3​(long origin, CoordIJ ij)
      Converts the IJ coordinates to an index, using a local IJ coordinate space anchored by origin.

      The local IJ coordinate space may have deleted regions and warping due to pentagon distortion. IJ coordinates are only comparable if they came from the same origin.

      This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.

      Parameters:
      origin - Anchoring index for the local coordinate space.
      ij - Coordinates in the local IJ coordinate space.
      Returns:
      Index represented by ij
    • experimentalLocalIjToH3

      public java.lang.String experimentalLocalIjToH3​(java.lang.String originAddress, CoordIJ ij)
      Converts the IJ coordinates to an index, using a local IJ coordinate space anchored by origin.

      The local IJ coordinate space may have deleted regions and warping due to pentagon distortion. IJ coordinates are only comparable if they came from the same origin.

      This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.

      Parameters:
      originAddress - Anchoring index for the local coordinate space.
      ij - Coordinates in the local IJ coordinate space.
      Returns:
      Index represented by ij
    • h3Line

      public java.util.List<java.lang.String> h3Line​(java.lang.String startAddress, java.lang.String endAddress)
      Given two H3 indexes, return the line of indexes between them (inclusive of endpoints).

      This function may fail to find the line between two indexes, for example if they are very far apart. It may also fail when finding distances for indexes on opposite sides of a pentagon.

      Notes:

      • The specific output of this function should not be considered stable across library versions. The only guarantees the library provides are that the line length will be `h3Distance(start, end) + 1` and that every index in the line will be a neighbor of the preceding index.
      • Lines are drawn in grid space, and may not correspond exactly to either Cartesian lines or great arcs.
      Parameters:
      startAddress - Start index of the line
      endAddress - End index of the line
      Returns:
      Indexes making up the line.
    • h3Line

      public java.util.List<java.lang.Long> h3Line​(long start, long end)
      Given two H3 indexes, return the line of indexes between them (inclusive of endpoints).

      This function may fail to find the line between two indexes, for example if they are very far apart. It may also fail when finding distances for indexes on opposite sides of a pentagon.

      Notes:

      • The specific output of this function should not be considered stable across library versions. The only guarantees the library provides are that the line length will be `h3Distance(start, end) + 1` and that every index in the line will be a neighbor of the preceding index.
      • Lines are drawn in grid space, and may not correspond exactly to either Cartesian lines or great arcs.
      Parameters:
      start - Start index of the line
      end - End index of the line
      Returns:
      Indexes making up the line.
    • polyfillAddress

      public java.util.List<java.lang.String> polyfillAddress​(java.util.List<LatLng> points, java.util.List<java.util.List<LatLng>> holes, int res)
      Finds indexes within the given geofence.
      Parameters:
      points - Outline geofence
      holes - Geofences of any internal holes
      res - Resolution of the desired indexes
    • polyfill

      public java.util.List<java.lang.Long> polyfill​(java.util.List<LatLng> points, java.util.List<java.util.List<LatLng>> holes, int res)
      Finds indexes within the given geofence.
      Parameters:
      points - Outline geofence
      holes - Geofences of any internal holes
      res - Resolution of the desired indexes
    • h3AddressSetToMultiPolygon

      public java.util.List<java.util.List<java.util.List<LatLng>>> h3AddressSetToMultiPolygon​(java.util.Collection<java.lang.String> h3Addresses, boolean geoJson)
      Create polygons from a set of contiguous indexes
    • h3SetToMultiPolygon

      public java.util.List<java.util.List<java.util.List<LatLng>>> h3SetToMultiPolygon​(java.util.Collection<java.lang.Long> h3, boolean geoJson)
      Create polygons from a set of contiguous indexes
    • h3GetResolution

      public int h3GetResolution​(java.lang.String h3Address)
      Returns the resolution of the provided index
    • h3GetResolution

      public int h3GetResolution​(long h3)
      Returns the resolution of the provided index
    • h3ToParent

      public long h3ToParent​(long h3, int res)
      Returns the parent of the index at the given resolution.
      Parameters:
      h3 - H3 index.
      res - Resolution of the parent, 0 <= res <= h3GetResolution(h3)
      Throws:
      java.lang.IllegalArgumentException - res is not between 0 and the resolution of h3, inclusive.
    • h3ToParentAddress

      public java.lang.String h3ToParentAddress​(java.lang.String h3Address, int res)
      Returns the parent of the index at the given resolution.
      Parameters:
      h3Address - H3 index.
      res - Resolution of the parent, 0 <= res <= h3GetResolution(h3)
    • h3ToChildren

      public java.util.List<java.lang.String> h3ToChildren​(java.lang.String h3Address, int childRes)
      Provides the children of the index at the given resolution.
      Parameters:
      childRes - Resolution of the children
    • h3ToChildren

      public java.util.List<java.lang.Long> h3ToChildren​(long h3, int childRes)
      Provides the children of the index at the given resolution.
      Parameters:
      h3 - H3 index.
      childRes - Resolution of the children
      Throws:
      java.lang.IllegalArgumentException - Invalid resolution
    • h3ToCenterChild

      public java.lang.String h3ToCenterChild​(java.lang.String h3, int childRes)
      Returns the center child at the given resolution.
      Parameters:
      h3 - Parent H3 index
      childRes - Resolution of the child
    • h3ToCenterChild

      public long h3ToCenterChild​(long h3, int childRes)
      Returns the center child at the given resolution.
      Parameters:
      h3 - Parent H3 index
      childRes - Resolution of the child
    • h3IsResClassIII

      public boolean h3IsResClassIII​(java.lang.String h3Address)
      Determines if an index is Class III or Class II.
      Returns:
      true if the index is Class III
    • h3IsResClassIII

      public boolean h3IsResClassIII​(long h3)
      Determines if an index is Class III or Class II.
      Parameters:
      h3 - H3 index.
      Returns:
      true if the index is Class III
    • compactAddress

      public java.util.List<java.lang.String> compactAddress​(java.util.Collection<java.lang.String> h3Addresses)
      Returns a compacted set of indexes, at possibly coarser resolutions.
    • compact

      public java.util.List<java.lang.Long> compact​(java.util.Collection<java.lang.Long> h3)
      Returns a compacted set of indexes, at possibly coarser resolutions.
    • uncompactAddress

      public java.util.List<java.lang.String> uncompactAddress​(java.util.Collection<java.lang.String> h3Addresses, int res)
      Uncompacts all the given indexes to resolution res.
    • uncompact

      public java.util.List<java.lang.Long> uncompact​(java.util.Collection<java.lang.Long> h3, int res)
      Uncompacts all the given indexes to resolution res.
    • h3ToString

      public java.lang.String h3ToString​(long h3)
      Converts from long representation of an index to String representation.
    • stringToH3

      public long stringToH3​(java.lang.String h3Address)
      Converts from String representation of an index to long representation.
    • cellArea

      public double cellArea​(java.lang.String h3Address, AreaUnit unit)
      Calculates the area of the given H3 cell.
      Parameters:
      h3Address - Cell to find the area of.
      unit - Unit to calculate the area in.
      Returns:
      Cell area in the given units.
    • cellArea

      public double cellArea​(long h3, AreaUnit unit)
      Calculates the area of the given H3 cell.
      Parameters:
      h3 - Cell to find the area of.
      unit - Unit to calculate the area in.
      Returns:
      Cell area in the given units.
    • pointDist

      public double pointDist​(LatLng a, LatLng b, LengthUnit unit)
      Return the distance along the sphere between two points.
      Parameters:
      a - First point
      b - Second point
      unit - Unit to return the distance in.
      Returns:
      Distance from point a to point b
    • exactEdgeLength

      public double exactEdgeLength​(java.lang.String edgeAddress, LengthUnit unit)
      Calculate the edge length of the given H3 edge.
      Parameters:
      edgeAddress - Edge to find the edge length of.
      unit - Unit of measure to use.
      Returns:
      Length of the given edge.
    • exactEdgeLength

      public double exactEdgeLength​(long edge, LengthUnit unit)
      Calculate the edge length of the given H3 edge.
      Parameters:
      edge - Edge to find the edge length of.
      unit - Unit of measure to use.
      Returns:
      Length of the given edge.
    • hexArea

      public double hexArea​(int res, AreaUnit unit)
      Returns the average area in unit for indexes at resolution res.
      Throws:
      java.lang.IllegalArgumentException - Invalid parameter value
    • edgeLength

      public double edgeLength​(int res, LengthUnit unit)
      Returns the average edge length in unit for indexes at resolution res .
      Throws:
      java.lang.IllegalArgumentException - Invalid parameter value
    • numHexagons

      public long numHexagons​(int res)
      Returns the number of unique H3 indexes at resolution res.
    • getRes0IndexesAddresses

      public java.util.Collection<java.lang.String> getRes0IndexesAddresses()
      Returns a collection of all base cells (H3 indexes are resolution 0).
    • getRes0Indexes

      public java.util.Collection<java.lang.Long> getRes0Indexes()
      Returns a collection of all base cells (H3 indexes are resolution 0).
    • getPentagonIndexesAddresses

      public java.util.Collection<java.lang.String> getPentagonIndexesAddresses​(int res)
      Returns a collection of all topologically pentagonal cells at the given resolution.
    • getPentagonIndexes

      public java.util.Collection<java.lang.Long> getPentagonIndexes​(int res)
      Returns a collection of all topologically pentagonal cells at the given resolution.
    • h3IndexesAreNeighbors

      public boolean h3IndexesAreNeighbors​(long a, long b)
      Returns true if the two indexes are neighbors.
    • h3IndexesAreNeighbors

      public boolean h3IndexesAreNeighbors​(java.lang.String a, java.lang.String b)
      Returns true if the two indexes are neighbors.
    • getH3UnidirectionalEdge

      public long getH3UnidirectionalEdge​(long a, long b)
      Returns a unidirectional edge index representing a towards b.
    • getH3UnidirectionalEdge

      public java.lang.String getH3UnidirectionalEdge​(java.lang.String a, java.lang.String b)
      Returns a unidirectional edge index representing a towards b.
    • h3UnidirectionalEdgeIsValid

      public boolean h3UnidirectionalEdgeIsValid​(long h3)
      Returns true if the given index is a valid unidirectional edge.
    • h3UnidirectionalEdgeIsValid

      public boolean h3UnidirectionalEdgeIsValid​(java.lang.String h3)
      Returns true if the given index is a valid unidirectional edge.
    • getOriginH3IndexFromUnidirectionalEdge

      public long getOriginH3IndexFromUnidirectionalEdge​(long h3)
      Returns the origin index of the given unidirectional edge.
    • getOriginH3IndexFromUnidirectionalEdge

      public java.lang.String getOriginH3IndexFromUnidirectionalEdge​(java.lang.String h3)
      Returns the origin index of the given unidirectional edge.
    • getDestinationH3IndexFromUnidirectionalEdge

      public long getDestinationH3IndexFromUnidirectionalEdge​(long h3)
      Returns the destination index of the given unidirectional edge.
    • getDestinationH3IndexFromUnidirectionalEdge

      public java.lang.String getDestinationH3IndexFromUnidirectionalEdge​(java.lang.String h3)
      Returns the destination index of the given unidirectional edge.
    • getH3IndexesFromUnidirectionalEdge

      public java.util.List<java.lang.Long> getH3IndexesFromUnidirectionalEdge​(long h3)
      Returns the origin and destination indexes (in that order) of the given unidirectional edge.
    • getH3IndexesFromUnidirectionalEdge

      public java.util.List<java.lang.String> getH3IndexesFromUnidirectionalEdge​(java.lang.String h3)
      Returns the origin and destination indexes (in that order) of the given unidirectional edge.
    • getH3UnidirectionalEdgesFromHexagon

      public java.util.List<java.lang.Long> getH3UnidirectionalEdgesFromHexagon​(long h3)
      Returns all unidirectional edges originating from the given index.
    • getH3UnidirectionalEdgesFromHexagon

      public java.util.List<java.lang.String> getH3UnidirectionalEdgesFromHexagon​(java.lang.String h3)
      Returns all unidirectional edges originating from the given index.
    • getH3UnidirectionalEdgeBoundary

      public java.util.List<LatLng> getH3UnidirectionalEdgeBoundary​(long h3)
      Returns a list of coordinates representing the given edge.
    • getH3UnidirectionalEdgeBoundary

      public java.util.List<LatLng> getH3UnidirectionalEdgeBoundary​(java.lang.String h3)
      Returns a list of coordinates representing the given edge.
    • h3GetFaces

      public java.util.Collection<java.lang.Integer> h3GetFaces​(java.lang.String h3)
      Find all icosahedron faces intersected by a given H3 index, represented as integers from 0-19.
      Parameters:
      h3 - Index to find icosahedron faces for.
      Returns:
      A collection of faces intersected by the index.
    • h3GetFaces

      public java.util.Collection<java.lang.Integer> h3GetFaces​(long h3)
      Find all icosahedron faces intersected by a given H3 index, represented as integers from 0-19.
      Parameters:
      h3 - Index to find icosahedron faces for.
      Returns:
      A collection of faces intersected by the index.