我使用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。看来,在光栅转换前后的价值观有很大的不同。
在被改造之前,我还能保留光栅的价值吗?
谢谢。
发布于 2017-02-06 09:08:11
projectRaster会使光栅单元在再投影过程中变形,特别是从投影坐标系(兰伯特方位)到地理坐标系统(wgs84),并且需要一些插值值。
此外,您还应该注意到您的单元格的大小有很大的差异,也许您可以强制使用“res=”在projectRaster中的分辨率?
另外,尝试'method =“ngb‘作为projectRaster内部的插值方法,以保持值不变。
https://stackoverflow.com/questions/42045599
复制相似问题