How to use the h3.geo_to_h3 function in h3

To help you get started, we’ve selected a few h3 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 / h3-py / tests / test_h3.py View on Github external
def test_h3_get_resolution():
    for res in range(16):
        h = h3.geo_to_h3(37.3615593, -122.0553238, res)
        assert h3.h3_get_resolution(h) == res
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
def test_to_local_ij_self():
    h = h3.geo_to_h3(0, 0, 9)
    out = h3.experimental_h3_to_local_ij(h, h)

    assert out == (-858, -2766)
github uber / h3-py / tests / test_h3.py View on Github external
def test_silly_geo_to_h3():
    lat, lng = 37.3615593, -122.0553238

    expected0 = '85283473fffffff'
    out0 = h3.geo_to_h3(lat, lng, 5)
    assert out0 == expected0

    out1 = h3.geo_to_h3(lat + 180.0, lng + 360.0, 5)
    expected1 = '85ca2d53fffffff'
    assert out1 == expected1
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
def test1():
    assert h3.geo_to_h3(37.7752702151959, -122.418307270836, 9) == '8928308280fffff'
github uber / h3-py / tests / test_h3.py View on Github external
def test_geo_to_h3():
    assert h3.geo_to_h3(37.3615593, -122.0553238, 5) == '85283473fffffff'
github uber / h3-py / tests / test_h3.py View on Github external
def test_uncompact_error():
    hexagons = [h3.geo_to_h3(37, -122, 10)]

    with pytest.raises(Exception):
        h3.uncompact(hexagons, 5)
github uber / h3-py / tests / test_h3.py View on Github external
def test_silly_geo_to_h3():
    lat, lng = 37.3615593, -122.0553238

    expected0 = '85283473fffffff'
    out0 = h3.geo_to_h3(lat, lng, 5)
    assert out0 == expected0

    out1 = h3.geo_to_h3(lat + 180.0, lng + 360.0, 5)
    expected1 = '85ca2d53fffffff'
    assert out1 == expected1
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
def test_from_local_ij_error():
    h = h3.geo_to_h3(0, 0, 0)

    baddies = [(1, -1), (-1, 1), (-1, -1)]
    for i, j in baddies:
        with pytest.raises(H3ValueError):
            h3.experimental_local_ij_to_h3(h, i, j)

    # inverting output should give good data
    nb = h3.hex_ring(h, k=1)
    goodies = {h3.experimental_h3_to_local_ij(h, p) for p in nb}

    out = {
        h3.experimental_local_ij_to_h3(h, i, j)
        for i, j in goodies
    }

    assert out == nb