def polygons_to_cells()

in src/h3/_cy/latlng.pyx [0:0]


def polygons_to_cells(polygons, int res):
    mvs = [
        polygon_to_cells(outer=poly.outer, res=res, holes=poly.holes)
        for poly in polygons
    ]

    n = sum(map(len, mvs))
    hmm = H3MemoryManager(n)

    # probably super inefficient, but it is working!
    # tood: move this to C
    k = 0
    for mv in mvs:
        for v in mv:
            hmm.ptr[k] = v
            k += 1

    return hmm.to_mv()