简体   繁体   English

识别栅格文件中的CRS

[英]Identify CRS in raster file

I would like to identify the correct coordinate reference system for the following ASCII raster file : 我想为以下ASCII栅格文件标识正确的坐标参考系统:

class       : RasterLayer 
dimensions  : 2160, 4320, 9331200  (nrow, ncol, ncell)
resolution  : 0.0833333, 0.0833333  (x, y)
extent      : -180, 179.9999, -90, 89.99993  (xmin, xmax, ymin, ymax)
coord. ref. : NA 
data source : C:/popc_0AD.asc 
names       : popc_0AD

I tried to guess the correct projection by setting the CRS to some of the common formats and plotting it, as suggested in related posts. 我试图通过将CRS设置为某些常见格式并进行绘制来猜测正确的投影,如相关文章中所建议的那样。 But I am still not sure about the correct setting. 但是我仍然不确定正确的设置。 As far as I am concerned raster and related packages do not entail any function able to estimate missing CRS information. 就我而言, raster和相关程序包不需要任何能够估算缺失的CRS信息的功能。 Do you have any idea what this raster file's CRS could be or how to find out? 您是否知道此栅格文件的CRS可能是什么或如何找到?

The extent suggests coordinates are not projected. 范围表明未投影坐标。 This seems to be the extent of Earth in degrees. 这似乎是地球的度数。 Then, you may want to use EPSG 4326, which is also crs="+proj=longlat +datum=WGS84 +no_defs" : 然后,您可能要使用EPSG 4326,它也是crs="+proj=longlat +datum=WGS84 +no_defs"

library(raster)

r <- raster("0AD_lu/cropland0AD.asc")
projection(r) <- "+proj=longlat +datum=WGS84 +no_defs"

However, it is much better to use dataset correctly built with the coordinates reference system. 但是,最好使用由坐标参考系统正确构建的数据集。 It is never recommended to guess it... But I know that having clean metadata is not always possible... 永远不建议猜测它...但是我知道拥有干净的元数据并不总是可能的...

You have 你有

r <- raster(nrow=2160, ncol=4320, xmn=-180, xmx=179.9999, ymn=-90, ymx=89.99993, crs=NA)

Sébastien Rochette already pointed out that this is surely lon/lat and that you can set the CRS to relfect that 塞巴斯蒂安·罗切特(SébastienRochette)已经指出,这肯定是长期的,您可以将CRS设置为

crs(r) <- "+proj=longlat +datum=WGS84"

It seems to me that the extent is a bit suspect. 在我看来,这种程度有点令人怀疑。 It looks like it is supposed to be a global raster, but that there has been some loss of precision. 看起来它应该是全局栅格,但是精度有所损失。 If so, you may correct that like this: 如果是这样,您可以这样纠正:

extent(r) <- c(-180, 180, -90, 90)

To get 要得到

r
#class      : RasterLayer 
#dimensions : 2160, 4320, 9331200  (nrow, ncol, ncell)
#resolution : 0.08333333, 0.08333333  (x, y)
#extent     : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
#crs        : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM