经纬度栅格 [英] Raster of Latitudes and Longitudes
问题描述
给定 raster
对象 r
,如何创建一个具有相同范围和分辨率的新栅格,单元格值等于相应的纬度(或经度)r
中的单元格?
Given raster
object r
, how can I create a new raster with the same extent and resolution, with cell values equal to the latitude (or longitude) of the corresponding cell in r
?
例如,r
可能看起来像:
For example, r
might look like:
r <- raster(matrix(runif(100), ncol=10))
推荐答案
如果您的问题是关于创建一个与另一个光栅对象具有相同范围和分辨率的新光栅对象,您可以使用命令 template
If your question is about create a new raster object which has the same extent and resolution of another raster object you can use command template
template
是用于设置范围的 Raster* 或 Extent 对象(如果是 Raster* 对象,则为 CRS).如果不是 NULL,则忽略参数 xmn、xmx、ymn、ymx 和 crs(除非模板是 Extent 对象)
template
is Raster* or Extent object used to set the extent (and CRS in case of a Raster* object). If not NULL, arguments xmn, xmx, ymn, ymx and crs (unless template is an Extent object) are ignored
r <- raster(matrix(runif(100), ncol=10))
r1 <- raster(x, template=r)
这篇关于经纬度栅格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!