Chunking strategies

wk_chunk_strategy_single()

wk_chunk_strategy_feature(n_chunks = NULL, chunk_size = NULL)

wk_chunk_strategy_coordinates(n_chunks = NULL, chunk_size = NULL, reduce = "*")

Arguments

n_chunks, chunk_size

Exactly one of the number of chunks or the chunk size. For wk_chunk_strategy_feature() the chunk size refers to the number of features; for wk_chunk_strategy_coordinates() this refers to the number of coordinates as calculated from multiple handleables using reduce.

reduce

For wk_chunk_strategy_coordinates() this refers to the function used with Reduce() to combine coordinate counts from more than one handleable.

Value

A function that returns a data.frame with columns from and towhen called with a handleable and the feature count.

Examples

feat <- c(as_wkt(xy(1:4, 1:4)), wkt("LINESTRING (1 1, 2 2)"))
wk_chunk_strategy_single()(list(feat), 5)
#>   from to
#> 1    1  5
wk_chunk_strategy_feature(chunk_size = 2)(list(feat), 5)
#>   from to
#> 1    1  2
#> 2    3  4
#> 3    5  5
wk_chunk_strategy_coordinates(chunk_size = 2)(list(feat), 5)
#>   from to
#> 1    1  2
#> 2    3  4
#> 3    5  5