Vector data cubes for changing geometries

Data cubes and structures
Spatial Data Science across Languages
Prague, Sept. 2024

Lorena Abad

University of Salzburg


Data structures in R

Data frames

Data cubes

A spatial object

polygons
Simple feature collection with 25 features and 2 fields
Geometry type: POLYGON
Dimension:     XY
Bounding box:  xmin: -0.2974337 ymin: -0.00297557 xmax: 0.9730806 ymax: 1.153558
Geodetic CRS:  WGS 84
First 10 features:
   gid   datetime                       geometry
1    a 2020-10-01 POLYGON ((0.5474949 0.80889...
2    b 2020-10-01 POLYGON ((0.2791708 0.83373...
3    c 2020-10-01 POLYGON ((0.2807462 0.62779...
4    d 2020-10-01 POLYGON ((0.7650701 0.47444...
5    e 2020-10-01 POLYGON ((0.3825692 0.35378...
6    a 2020-10-02 POLYGON ((0.4961102 0.87283...
7    b 2020-10-02 POLYGON ((0.3298312 0.76120...
8    c 2020-10-02 POLYGON ((0.328914 0.568743...
9    d 2020-10-02 POLYGON ((0.7217233 0.52617...
10   e 2020-10-02 POLYGON ((0.3101455 0.31689...

A spatial object

plot(polygons)

Raster data cubes

Vector data cubes

Vector data cubes

Summary geometries

Summary geometries in {post}

Changing geometries

Union

Centroid

Bounding box

Minimum rotated rectangle

Convex hull


VDCs in array form

VDCs as post_array

as_post_array(polygons)
stars object with 2 dimensions and 1 attribute
attribute(s):
         geometry  
 POLYGON      :25  
 epsg:4326    : 0  
 +proj=long...: 0  
dimension(s):
         from to     offset  delta refsys point
geom_sum    1  5         NA     NA WGS 84  TRUE
datetime    1  5 2020-10-01 1 days   Date FALSE
                                                           values
geom_sum POINT (0.647816 0.9018588),...,POINT (0.4690683 0.17772)
datetime                                                     NULL

VDCs in tabular form

VDCs in tabular form

VDCs as post_table

as_post_table(polygons) |> 
  face_spatial()
# 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]>

VDCs as post_table

as_post_table(polygons) |> 
  face_temporal()
# cubble:   key: gid [5], index: datetime, long form
# temporal: 2020-10-01 -- 2020-10-05 [1D], no gaps
# spatial:  long [dbl], lat [dbl], geom_sum [POINT [°]]
   gid   datetime                                                       geometry
 * <chr> <date>                                                    <POLYGON [°]>
 1 a     2020-10-01 ((0.5474949 0.8088912, 0.4874872 0.8838477, 0.5520055 1.032…
 2 a     2020-10-02 ((0.4961102 0.8728385, 0.4361026 0.947795, 0.5006209 1.0966…
 3 a     2020-10-03 ((0.5578801 0.8616378, 0.5623908 1.085448, 0.8520717 0.8981…
 4 a     2020-10-04 ((0.5652241 0.872057, 0.5685463 1.036898, 0.7819022 0.89897…
 5 a     2020-10-05 ((0.6063791 0.8304178, 0.5463715 0.9053744, 0.6108898 1.054…
 6 b     2020-10-01 ((0.2791708 0.8337388, -0.2847997 0.6540191, -0.2825181 0.6…
 7 b     2020-10-02 ((0.3298312 0.7612067, -0.2341393 0.5814869, -0.2318577 0.5…
 8 b     2020-10-03 ((0.3796448 0.767853, -0.1843257 0.5881332, 0.09777458 1.05…
 9 b     2020-10-04 ((0.3642467 0.779727, -0.1182199 0.6259799, 0.1231118 1.026…
10 b     2020-10-05 ((0.2665368 0.8649996, -0.2974337 0.6852798, -0.2951521 0.6…
# ℹ 15 more rows

Applications









Research supported by the Austrian Research Promotion Agency (FFG) through the project ReHIKE (“Analysing Glacier Retreat Effects on Alpine Hiking Infrastructure using Earth Observation”; project number: FO999911954).

Applications

Svalbard glaciers

Minimum rotated rectangle

Centroids

Applications

Time series analysis

What’s next for me?

  • Set-up functions for raster-vector data cube interaction with time-matching
    • st_extract(rdc, vdc)
    • st_crop(rdc, vdc)
  • Work on a concept to group changing geometries when group IDs are unknown
  • Application cases in my RG projects

What could be next?

  • Find out ways to save post objects to file
    • zarr files are an option, and in general something to look into for vector data cubes
    • {xvec} issue
  • Test implementations for Python (and Julia?)

Credits

Cover photo by Etienne Girardet on Unsplash

Pasterze glacier photo by Karsten Würth on Unsplash

References

König, Max, Christopher Nuth, Jack Kohler, and Moholdt. 2014. “A Digital Glacier Database for Svalbard.” In Global Land Ice Measurements from Space, 229–39. Springer Berlin Heidelberg. https://doi.org/10.1007/978-3-540-79818-7_10.
Pebesma, Edzer, and Roger Bivand. 2023. Spatial Data Science with Applications in R. Geographical Analysis. 1st ed. Chapman & Hall. https://r-spatial.org/book/.
Wickham, Hadley. 2019. Advanced R. CRC Press.