Create a set of GCPs (ground control points) from dimension, extent

gcp_extent(dimension, extent = NULL)

gcp_extent_arg(gcp)

Arguments

dimension

size of grid 'ncol,nrow'

extent

extent 'xmin,xmax,ymin,ymax'

gcp

ground control point ('col,row,x,y')

Value

gcp_extent returns the col,row,x,y values, gcp_extent_arg returns formatted as a GDAL 'vrt://' connection string

Examples

gcp_extent(c(10, 20))
#>      col row   x    y
#> [1,]   1   1 0.5  0.5
#> [2,]  10   1 9.5  0.5
#> [3,]   1  20 0.5 19.5
#> [4,]  10  20 9.5 19.5
dsn <- sprintf("vrt://%s?%s", mem(volcano), gcp_extent_arg(gcp_extent(dim(volcano))))
gcp <- gcp_extent(dim(volcano), c(-180, 180, -90, 90))
gcp_extent_arg(gcp)
#> [1] "gcp=1,1,-177.931034482759,-88.5245901639344&gcp=87,1,177.931034482759,-88.5245901639344&gcp=1,61,-177.931034482759,88.5245901639344&gcp=87,61,177.931034482759,88.5245901639344"