I'd like to know how terra determines the number of rows and columns in a raster that is projected without a template raster. For example:
library(terra)
from <- rast()
mollweide <- 'PROJCRS[\"Sphere_Mollweide\",\n BASEGEOGCRS[\"Unknown datum based upon the Authalic Sphere\",\n DATUM[\"Not specified (based on Authalic Sphere)\",\n ELLIPSOID[\"Sphere\",6371000,0,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"Degree\",0.0174532925199433]]],\n CONVERSION[\"Sphere_Mollweide\",\n METHOD[\"Mollweide\"],\n PARAMETER[\"Longitude of natural origin\",0,\n ANGLEUNIT[\"Degree\",0.0174532925199433],\n ID[\"EPSG\",8802]],\n PARAMETER[\"False easting\",0,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8806]],\n PARAMETER[\"False northing\",0,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8807]]],\n CS[Cartesian,2],\n AXIS[\"(E)\",east,\n ORDER[1],\n LENGTHUNIT[\"metre\",1]],\n AXIS[\"(N)\",north,\n ORDER[2],\n LENGTHUNIT[\"metre\",1]],\n USAGE[\n SCOPE[\"Not known.\"],\n AREA[\"World.\"],\n BBOX[-90,-180,90,180]],\n ID[\"ESRI\",53009]]'
to <- project(from, mollweide)
dim(from)
dim(to)
Inferring from the help for project(), it seems terra is using gdalwarp unless the user disables it, but the help page for gdalwarp does not elucidate.
The output raster geometry is chosen such that the extent and resolution closely match the input raster.