How to use the h3.h3_distance 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_cells_and_edges.py View on Github external
def test_validation():
    h = '8a28308280fffff'  # invalid cell

    with pytest.raises(H3CellError):
        h3.h3_get_base_cell(h)

    with pytest.raises(H3CellError):
        h3.h3_get_resolution(h)

    with pytest.raises(H3CellError):
        h3.h3_to_parent(h, 9)

    with pytest.raises(H3CellError):
        h3.h3_distance(h, h)

    with pytest.raises(H3CellError):
        h3.k_ring(h, 1)

    with pytest.raises(H3CellError):
        h3.hex_ring(h, 1)

    with pytest.raises(H3CellError):
        h3.h3_to_children(h, 11)

    with pytest.raises(H3CellError):
        h3.compact({h})

    with pytest.raises(H3CellError):
        h3.uncompact({h}, 10)
github uber / h3-py / tests / test_h3.py View on Github external
def test_h3_distance():
    h = '89283082993ffff'

    assert 0 == h3.h3_distance(h, h)
    assert 1 == h3.h3_distance(h, '8928308299bffff')
    assert 5 == h3.h3_distance(h, '89283082827ffff')
github uber / h3-py / tests / test_h3.py View on Github external
def test_h3_distance():
    h = '89283082993ffff'

    assert 0 == h3.h3_distance(h, h)
    assert 1 == h3.h3_distance(h, '8928308299bffff')
    assert 5 == h3.h3_distance(h, '89283082827ffff')
github uber / h3-py / tests / test_h3.py View on Github external
def test_h3_distance():
    h = '89283082993ffff'

    assert 0 == h3.h3_distance(h, h)
    assert 1 == h3.h3_distance(h, '8928308299bffff')
    assert 5 == h3.h3_distance(h, '89283082827ffff')
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
def test_distance():
    h = '8a28308280c7fff'
    assert h3.h3_distance(h, h) == 0

    n = h3.hex_ring(h, 1).pop()
    assert h3.h3_distance(h, n) == 1

    n = h3.hex_ring(h, 2).pop()
    assert h3.h3_distance(h, n) == 2
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
def test_distance():
    h = '8a28308280c7fff'
    assert h3.h3_distance(h, h) == 0

    n = h3.hex_ring(h, 1).pop()
    assert h3.h3_distance(h, n) == 1

    n = h3.hex_ring(h, 2).pop()
    assert h3.h3_distance(h, n) == 2