A four figure extent (xmin, xmax, ymin, ymax) is used to approximate the boundary of its reprojected version by interpolating new vertices along each edge.

reproj_extent(extent, target, limit = NULL, ..., source = NULL)

Arguments

extent

a four element vector of extent c(xmin, xmax, ymin, ymax)

target

target specification (PROJ.4 string or epsg code)

limit

if used, a one or two element numeric vector to give the maximum radius to the edge of the extent from the middle

...

arguments passed to proj4::ptransform()

source

source specification (PROJ.4 string or epsg code)

Value

four value extent c(xmin, xmax, ymin, ymax)

Details

This is a simple version of what GDAL's 'SuggestedWarpOutput' does, and similar functions like the raster package 'projectExtent()'.

Internal functions unpack the various stages, and might be exposed in future. These stages are

  1. interpolate around the boundary with correct ordering (can be used as a polygon or line)

  2. reproject the interpolated boundary

  3. summarize the interpolated boundary to the new extent

Examples

reproj_extent(c(0, 10, 0, 20), "+proj=laea", source = "+proj=longlat")
#> [1]       0 1111783       0 2209293