Skip to contents

Array class for easier navigation of vector spatial datasets

Arguments

stack

A list of sf-class objects or sfc-class objects.

index

A vector, matrix or array type object. Includes either the indices of layers in the stack, or their names.

dim

A numeric vector. Same as for array, creates proxy procedurally.

Value

An 'SfcArray' or 'SfArray'-class object.

Details

The class implements structures to organize entire 'sfc' and 'sf' objects that share coordinate reference systems. The 'SfcArray' class is derived from 'XArray' and represents arrays of geometry sets. The 'SfArray' class is derived from 'SfArray', that allows the wrapping of 'sf' objects with attributes. Subsetting rules were defined using the proxy object in the @index slot. See examples for implementations.

The classes have two slots: @stack: A list object with multiple 'sf' class layers, the actual data. @index: A proxy object that represents the organization of the layers.

Examples

# example data
  library(sf) 
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
#> 
#> Attaching package: ‘sf’
#> The following objects are masked from ‘package:via’:
#> 
#>     st_bbox, st_crs, st_transform
  data(paleocoastlines) 
  st <-paleocoastlines@stack
  ind <- 1:nlayers(st)
  dim(ind) <- c(3,2)
  dimnames(ind) <- list(age=c(0, 10, 20), c("margin", "coastlines"))
  sa<- SfcArray(stack=st, index=ind)