How to use the h3.h3_to_children 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
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_cells_and_edges.py View on Github external
def test_validation2():
    h = '8928308280fffff'

    with pytest.raises(H3ResolutionError):
        h3.h3_to_children(h, 17)

    assert not h3.h3_indexes_are_neighbors(h, h)
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
# same resolution is set of just cell itself
    out = h3.h3_to_children(h, 9)
    assert out == {h}

    # one below should give children
    expected = {
        '8a28308280c7fff',
        '8a28308280cffff',
        '8a28308280d7fff',
        '8a28308280dffff',
        '8a28308280e7fff',
        '8a28308280effff',
        '8a28308280f7fff'
    }
    out = h3.h3_to_children(h, 10)
    assert out == expected

    # finest resolution cell should return error for children
    h = '8f04ccb2c45e225'
    with pytest.raises(H3ResolutionError):
        h3.h3_to_children(h)
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
def test_children():
    h = '8928308280fffff'

    # one above should raise an exception
    with pytest.raises(H3ResolutionError):
        h3.h3_to_children(h, 8)

    # same resolution is set of just cell itself
    out = h3.h3_to_children(h, 9)
    assert out == {h}

    # one below should give children
    expected = {
        '8a28308280c7fff',
        '8a28308280cffff',
        '8a28308280d7fff',
        '8a28308280dffff',
        '8a28308280e7fff',
        '8a28308280effff',
        '8a28308280f7fff'
    }
    out = h3.h3_to_children(h, 10)
    assert out == expected

    # finest resolution cell should return error for children
github uber / h3-py / tests / test_h3.py View on Github external
def test_h3_to_children():
    h = '8828308281fffff'
    children = h3.h3_to_children(h, 9)

    assert len(children) == 7
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
expected = {
        '8a28308280c7fff',
        '8a28308280cffff',
        '8a28308280d7fff',
        '8a28308280dffff',
        '8a28308280e7fff',
        '8a28308280effff',
        '8a28308280f7fff'
    }
    out = h3.h3_to_children(h, 10)
    assert out == expected

    # finest resolution cell should return error for children
    h = '8f04ccb2c45e225'
    with pytest.raises(H3ResolutionError):
        h3.h3_to_children(h)
github uber / h3-py / tests / test_cells_and_edges.py View on Github external
def test_children():
    h = '8928308280fffff'

    # one above should raise an exception
    with pytest.raises(H3ResolutionError):
        h3.h3_to_children(h, 8)

    # same resolution is set of just cell itself
    out = h3.h3_to_children(h, 9)
    assert out == {h}

    # one below should give children
    expected = {
        '8a28308280c7fff',
        '8a28308280cffff',
        '8a28308280d7fff',
        '8a28308280dffff',
        '8a28308280e7fff',
        '8a28308280effff',
        '8a28308280f7fff'
    }
    out = h3.h3_to_children(h, 10)