a5_covering_from_arrow: Convert between a5_covering and Arrow list<uint64> arrays

View source: R/arrow.R

a5_covering_from_arrowR Documentation

Convert between a5_covering and Arrow ⁠list<uint64>⁠ arrays

Description

Losslessly convert a5_covering vectors to and from Arrow ⁠list<uint64>⁠ arrays, one list element per covering. Each element holds the covering's compacted cells followed by its compaction marker, the layout every A5 library uses, so the resolution travels with the data into Parquet, DuckDB, Python or JavaScript. A missing covering is a null element.

Usage

a5_covering_from_arrow(x)

a5_covering_to_arrow(x)

Arguments

x

For a5_covering_from_arrow(), an Arrow Array or ChunkedArray of type ⁠list<uint64>⁠. For a5_covering_to_arrow(), an a5_covering vector.

Details

a5_covering_from_arrow() accepts coverings written by any A5 library. Each one is checked, sorted and compacted; an element without a compaction marker stands for the resolution of its finest cell.

Value

a5_covering_from_arrow() returns an a5_covering vector. a5_covering_to_arrow() returns an Arrow Array of type ⁠list<uint64>⁠.

See Also

a5_cell_to_arrow() for single cells.

Examples


cells <- a5_lonlat_to_cell(c(-3.19, 135), c(55.95, 0), resolution = 10)
disks <- a5_grid_disk(cells, k = 2)
arr <- a5_covering_to_arrow(disks)
arr$type$ToString()
identical(a5_covering_from_arrow(arr), disks)


a5R documentation built on Oct. 19, 2026, 5:08 p.m.