【发布时间】:2023-03-06 10:12:01
【问题描述】:
我正在使用 wgs84 的投影分析栅格数据,我还需要从 USGS (https://lta.cr.usgs.gov/HYDRO1K) 下载的 Hydro1k 数据。然而,Hydro1k 使用具有特定原点和其他参数的兰伯特方位角等面积投影。所以我决定将 Hydro1k 的投影转换为 WGS 84 以供将来分析。试了网上找到的一种方法,修改后的投影好像没问题。
下面是我使用的代码和光栅的属性:
#Import the selected raster after knowing name
As.fa.1k=raster(Path.all.1k[4])
#Show the attribute of the input raster from README file:
Projection used: Lambert Azimuthal Equal Area
Units = meters
Pixel Size = 1000 meters
Radius of Sphere of Influence = 6,370,997 meters
Longitude of Origin = 20 00 00E
Latitude of Origin = 55 00 00N
False Easting = 0.0
False Northing = 0.0
#Custom the projection based on the origin of raster
As.proj="+proj=laea +lon_0=100 +lat_0=45 +ellps=sphere"
#Assign CRS to layer
crs(As.fa.1k)=As.proj
#Get wgs4 projection
wgs = "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
#Assign wgs84 to raster with lambert projection
As.wgs=projectRaster(As.fa.1k, crs=wgs)
但是,投影被转换的栅格中的值似乎很奇怪:
#values in raster before being transformed
class : RasterLayer
dimensions : 8384, 9102, 76311168 (nrow, ncol, ncell)
resolution : 1000, 1000 (x, y)
extent : -4462500, 4639500, -3999500, 4384500 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=laea +lon_0=-100 +lat_0=45 +ellps=sphere
names : na_fd
values : -9999, 255 (min, max)
-9999 应该是海洋中细胞的值。
#values in raster after after transformed
class : RasterLayer
dimensions : 1910, 5497, 10499270 (nrow, ncol, ncell)
resolution : 0.0655, 0.04495 (x, y)
extent : -180.0035, 180.05, -0.5929785, 85.26152 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
names : na_fd
values : 1, 55537 (min, max)
而且我是在变换前从栅格中提取值,最大值也是55537。看来变换前后栅格中的值差别很大。
如何在转换之前保持栅格的值?
谢谢。
【问题讨论】:
标签: transform raster projection r-raster