Reads a grid parquet (e.g., tikls100_sauzeme.parquet) and writes per-tile parquet
files into out_dir. Output filenames are formed as:
[base]_[tilename].parquet, where:
base = the substring of the input filename before the first underscore (e.g.,
"tikls100"fromtikls100_sauzeme.parquet);tilename = the value from
tile_field(e.g.,2434), or an auto-generated chunk id (e.g.,tile_00001) iftile_fieldisNULLor not present.
Tiling can be controlled either by an existing tile_field (preferred) or by
automatic chunking using chunk_size.
Usage
tile_vector_grid(
grid_path = "./Templates/TemplateGrids/tikls100_sauzeme.parquet",
out_dir = "./Templates/TemplateGrids/lapas",
tile_field = "lapa",
chunk_size = 50000L,
overwrite = FALSE,
quiet = FALSE
)Arguments
- grid_path
Character. Path to the source grid parquet (default
"./Templates/TemplateGrids/tikls100_sauzeme.parquet").- out_dir
Character. Where to write tiles (default
"./Templates/TemplateGrids/lapas").- tile_field
Character or
NULL. If provided and exists in data (e.g.,"lapa"), tiles are split by unique values of this field. IfNULLor not found, useschunk_size. Default"lapa".- chunk_size
Integer. Number of rows per tile when
tile_fieldisNULLor missing. Default50000L.- overwrite
Logical. Overwrite existing tile files? Default
FALSE.- quiet
Logical. Suppress messages? Default
FALSE.
Details
Uses sfarrow for Parquet I/O. CRS and geometry are preserved. Designed for stable, idempotent outputs, deterministic filenames, and clean skipping of existing tiles.
Examples
if (FALSE) { # \dontrun{
# Split by an existing field (e.g., "lapa")
tile_vector_grid(
grid_path = "./Templates/TemplateGrids/tikls100_sauzeme.parquet",
out_dir = "./Templates/TemplateGrids/lapas",
tile_field = "lapa"
)
# Fallback to chunking if tile_field is NULL or missing
tile_vector_grid(
grid_path = "./Templates/TemplateGrids/tikls100_sauzeme.parquet",
out_dir = "./Templates/TemplateGrids/lapas",
tile_field = NULL,
chunk_size = 25000
)
} # }