With this function you can create footprints for vector or raster datasets.
Specify a character vector of GDAL readable sources of either vector
or raster type. Internally, GDAL will be used to create an sf object
with a single column indicating the source and the geometry indicating
the bounding box of the respective source.
Note, the performance for remote sources is dependent on your connection to
the server. If you have other means to create footprints in your resource
function (e.g. by using the output {rstac::items_bbox()}
) you should prefer
those means over this function for remote files.
Arguments
- srcs
A character vector with GDAL readable paths to either vector or raster sources, then internal footprint functions are called, or an sf object which will be appended for filenames and potential options.
- filenames
A character vector indicating the filenames of the source data sets if they were written to a destionation. Defaults to
basename(srcs)
in case of character type orbasename(srcs[["source"]])
in case of an sf object.- what
A character vector indicating if the files are vector or raster files.
- oo
Either a list or a character vector with opening options (-oo) of the respective GDAL driver. A list must have equal length of the input sources, a vector will be recycled.
- co
Either a list or a character vector with creation options (-co) of the respective GDAL driver. A list must have equal length of the input sources, a vector will be recycled.
- precision
A numeric indicating the precision of coordinates when a binary round-trip is done (see
?sf::st_as_binary()
).
Examples
# a vector resource
# requires GDAL >= 3.7.0
if (FALSE) {
vec <- system.file("shape/nc.shp", package = "sf")
make_footprints(vec, what = "vector")
}
# a raster resource
ras <- system.file("ex/elev.tif", package = "terra")
make_footprints(ras, what = "raster")
#> Simple feature collection with 1 feature and 6 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 5.74167 ymin: 49.44167 xmax: 6.53333 ymax: 50.19167
#> Geodetic CRS: WGS 84
#> # A tibble: 1 × 7
#> filename location type oo co source geometry
#> <chr> <chr> <chr> <list> <list> <chr> <POLYGON [°]>
#> 1 elev.tif /home/runner/wo… rast… <NULL> <NULL> /home… ((5.74167 49.44167, 6.53…