Pulls all batches from the execution plan and materializes the result in
memory. A plain query returns a data.frame. A query whose output still
carries a geometry column, which the spatial verbs (spatial_map(),
spatial_join(), spatial_clip(), spatial_overlay() and the rest) mark on
the node, returns an sf object, with the hex-WKB column decoded and the
node's coordinate reference system set. A string column whose values are
hex-encoded WKB is recognised from its content, so a stored geometry column
comes back as sf without any spatial verb. The geometry marker follows the
column through filter(), select(), rename(), mutate() and joins, and
is dropped once the column is.
Usage
collect(x, ...)
# S3 method for class 'vectra_node'
collect(x, sf = TRUE, geom = NULL, crs = NULL, ...)Arguments
- x
A
vectra_nodeobject.- ...
Ignored.
- sf
If
TRUE(default), a spatial result is returned as ansfobject.FALSEreturns the data.frame with the geometry as a hex-WKB string column. Ignored for a non-spatial query.- geom
Name of a hex-WKB geometry column to decode when the node does not already carry one, for instance a column read straight from a
.vtrfile.NULL(default) uses the geometry column the node carries.- crs
Coordinate reference system for the
sfresult.NULL(default) uses the one the node carries, or leaves it unknown.
Details
For a result still larger than RAM, keep it as a node and write it out with
write_vtr(), stream it to a vector file with sf::st_write(), or reduce it
with collect_chunked().