Skip to contents

post_table is a spatio-temporal tabular data structure that organises polygons that change their shape in space and time. It extends the cubble_df classes for vector data cubes to support changing geometries in the temporal face of the cube. The post_table geometry for the spatial face of the cube defaults to a column named geom_sum, while the changing geometry provided is passed on to the temporal face of the cube.

Usage

as_post_table(
  x,
  group_id = NULL,
  time_column_name = NULL,
  sf_column_name = NULL,
  geometry_summary = summarise_geometry_centroid,
  ...
)

# S3 method for class 'sf'
as_post_table(
  x,
  group_id = NULL,
  time_column_name = NULL,
  sf_column_name = NULL,
  geometry_summary = summarise_geometry_centroid,
  ...
)

# S3 method for class 'post_array'
as_post_table(x, ..., drop_empty = TRUE)

# S3 method for class 'post_table'
as_post_table(x, ...)

Arguments

x

object to convert to post_table with POLYGON/MULTIPOLYGON geometries and a date/time column.

group_id

See Details. Defaults to the first non-spatial, non-temporal column in x.

time_column_name

(character) name of column with the temporal dimension information. Defaults to the first temporal column in x.

sf_column_name

(character) name of column with changing geometries. Defaults to active sf_column.

geometry_summary

(function) function to compute the summary geometry. Alternatively an sfc object with summary geometries (i.e., the result of a summarise_geometry_*() function or a custom sfc). See summarise_geometry for functions or pass your own summarise_geometry function.

...

additional parameters passed on to geometry_summary function.

drop_empty

(logical) should empty geometries be dropped during post_table creation? Defaults to TRUE

Value

an object of class post_table.

Details

group_id should be the name of the column containing the grouping identifier for the changing polygons or a vector with group identifiers. Character, integer, double and factor vectors are supported. The vector should be of length 1 or the same as nrow(x). A vector of length 1 repeats the value for all the rows. Providing a vector assumes that the ordering of the groups is correct and that there are no duplicated timestamps per group

References

Abad, L., Sudmanns, M., and Hölbling, D. (2024) Vector data cubes for features evolving in space and time, AGILE GIScience Ser., 5, 16, https://doi.org/10.5194/agile-giss-5-16-2024

Examples

as_post_table(polygons)
#> # cubble:   key: gid [5], index: datetime, nested form, [sf]
#> # spatial:  [0, 0.18, 0.75, 0.9], WGS 84
#> # temporal: datetime [date], geometry [POLYGON [°]]
#>   gid       long   lat                 geom_sum ts          
#> * <chr>    <dbl> <dbl>              <POINT [°]> <list>      
#> 1 a      0.648   0.902     (0.647816 0.9018588) <sf [5 × 2]>
#> 2 b     -0.00254 0.840 (-0.002543201 0.8403816) <sf [5 × 2]>
#> 3 c      0.390   0.541    (0.3897167 0.5412363) <sf [5 × 2]>
#> 4 d      0.753   0.354     (0.752585 0.3538271) <sf [5 × 2]>
#> 5 e      0.469   0.178      (0.4690683 0.17772) <sf [5 × 2]>

if(require(dplyr, quietly = TRUE)) {
  library(sf, quietly = TRUE)
  polygons |>
    mutate(area = st_area(geometry)) |>
    as_post_table(
     geometry_summary = summarise_geometry_union
   )
}
#> Warning: st_centroid assumes attributes are constant over geometries
#> # cubble:   key: gid [5], index: datetime, nested form, [sf]
#> # spatial:  [-0.3, 0, 0.97, 1.15], WGS 84
#> # temporal: datetime [date], area [[m^2]], geometry [POLYGON [°]]
#>   gid       long   lat                                            geom_sum ts   
#> * <chr>    <dbl> <dbl>                                       <POLYGON [°]> <lis>
#> 1 a      0.648   0.902 ((0.4971355 0.8717961, 0.5474949 0.8088912, 0.5905… <sf> 
#> 2 b     -0.00254 0.840 ((-0.1774445 0.5995572, -0.1843257 0.5881332, 0.37… <sf> 
#> 3 c      0.390   0.541 ((0.28657 0.6085207, 0.2663408 0.6222649, 0.214584… <sf> 
#> 4 d      0.753   0.354 ((0.5737123 0.4613799, 0.6063966 0.4263975, 0.5272… <sf> 
#> 5 e      0.469   0.178 ((0.2973931 0.2557416, 0.2813385 0.2544898, 0.2452… <sf>