reproj_extent: Reproject extent

View source: R/reproj-extent.R

reproj_extentR Documentation

Reproject extent

Description

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.

Usage

reproj_extent(extent, target, ..., source = NULL, dimension = c(64, 64))

Arguments

extent

a four element vector of extent c(xmin, xmax, ymin, ymax), or matrix with 4 columns

target

target specification (PROJ.4 string or epsg code)

...

arguments passed to proj4::ptransform()

source

source specification (PROJ.4 string or epsg code)

dimension

a 2 element integer to give the discretization within each extent (defaults to 64x64)

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

Value

four value extent c(xmin, xmax, ymin, ymax) or a matrix with four columns (matching the input)

Examples

reproj_extent(c(0, 10, 0, 20), "+proj=laea", source = "+proj=longlat")

r-gris/reproj documentation built on July 5, 2025, 1:38 a.m.