Writes the rows of an overture_call to Parquet files under output_dir,
in Overture's own theme=<theme>/type=<type>/ layout, and returns a new
overture_call that reads from the copy. Each type= directory also gets
an _overture.json manifest recording the source release and the bounding
box of every file, so open_curtain() on the copy skips files by location
just as it does on S3. snapshot_overture() defaults output_dir to
tempdir() and overwrite to TRUE.
Usage
record_overture(
curtain_call,
output_dir,
overwrite = FALSE,
write_opts = NULL,
partition_by = NULL,
grid = NULL,
spatial_filter = NULL,
...
)
snapshot_overture(
curtain_call,
output_dir = tempdir(),
overwrite = TRUE,
write_opts = NULL,
partition_by = NULL,
grid = NULL,
spatial_filter = NULL,
...
)Arguments
- curtain_call
An
overture_callobject, or the name of an Overture type (such as"building") to open withopen_curtain()first.- output_dir
The directory where the data will be saved.
- overwrite
If
FALSE(default),output_dirmust be empty. IfTRUE, thetheme=/type=directories being written are replaced; other files inoutput_dirare left alone.- write_opts
A character vector of extra options for DuckDB's
COPYcommand, such as"ROW_GROUP_SIZE 100000". Usepartition_by, notPARTITION_BY, to change the layout.- partition_by
Names of columns to partition by, below
themeandtype. Add columns withdplyr::mutate()first if needed.- grid
Cell size in degrees. If set, the copy is further partitioned into a grid of that size (columns
x_cellandy_cell, the cell's south-west corner), so each file covers a compact area and a laterspatial_filterskips most of them.- spatial_filter, ...
Passed to
open_curtain()whencurtain_callis a type name.
Value
An overture_call reading from the downloaded data. Use
dplyr::show_query() to see its query and dplyr::collect() to bring
the rows into R.
Examples
if (FALSE) { # interactive()
broadway <- c(xmin = -73.99, ymin = 40.755, xmax = -73.98, ymax = 40.762)
buildings <- open_curtain("building", spatial_filter = broadway)
local_buildings <- record_overture(buildings, tempdir(), overwrite = TRUE)
# or in one call
local_buildings <- record_overture(
"building", tempdir(), overwrite = TRUE, spatial_filter = broadway
)
}
