我想把以下GIS数据文件读入R:
一些数据规范在这里:
图像类型:通用平面二进制,字节交错(BIL)
投射:中断Goode Homolosine
我试图使用R包"raster",但失败了.
library(raster)
r <- raster(file.choose())
Error in .local(.Object, ...) :
`C:\global_forest_cover.img' not recognised as a supported file format.
Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", :
Cannot create a RasterLayer object from this file.
Run Code Online (Sandbox Code Playgroud)
那么,我该如何将这个GIS数据加载到R中呢?另外,将投影"Interrupted Goode Homolosine"转换为LongLat?
创建一个名为的文件,global_forest_cover.hdr并将来自http://edc2.usgs.gov/glcc/fao/header_file.php的标题信息粘贴到其中:
BYTEORDER M
LAYOUT BIL
NROWS 15059
NCOLS 36543
NBANDS 1
NBITS 8
BANDROWBYTES 36543
TOTALROWBYTES 36543
ULXMAP -17359000
ULYMAP 8673000
XDIM 1000
YDIM 1000
Run Code Online (Sandbox Code Playgroud)
然后读取.img文件:
> forest = raster("global_forest_cover.img")
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.6.3, released 2009/11/19
Path to GDAL shared files: /usr/share/gdal16
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: (autodetected)
> forest
class : RasterLayer
dimensions : 15059, 36543, 550301037 (nrow, ncol, ncell)
resolution : 1000, 1000 (x, y)
extent : -17359500, 19183500, -6385500, 8673500 (xmin, xmax, ymin, ymax)
coord. ref. : NA
data source : /home/nobackup/rowlings/Downloads/global_forest_cover.img
names : global_forest_cover
values : 0, 255 (min, max)
Run Code Online (Sandbox Code Playgroud)
GDAL查看该.hdr文件并使用它来计算文件中15059*36543字节的结构.img.
但是它没有投影信息.但即便如此,将IGH预测扭曲回拉特长度可能会有些问题.如果你看看其他IGH投影地图,你会看到它们涉及拆除海洋以帮助平整地球.要回到lat-long,你需要扭转所有这些平坦和撕裂.它应该是可能的,我认为最新的PROJ4库支持IGH预测,但可能只在一个方向上.但除非您使用与用于创建数据的完全相同的代码,但反过来可能无法得到正确的答案.
鉴于该.hdr文件未包含在zip中,并且该投影对于进一步分析并不是一个好的投影,我会去寻找另一个数据来源.此数据显然仅用于显示目的.它也很差,因为它似乎没有丢失IGH投影分裂地球的数据值 - 比较http://edc2.usgs.gov/glcc/fao/index.php页面上的图片与其他IGH预测http://en.wikipedia.org/wiki/Goode_homolosine_projection
我认为这里的数据可能更合适:http://www.fao.org/forestry/32203/en/
> r=raster("./fceurope/europe/w001001.adf")
> r
class : RasterLayer
dimensions : 20000, 40000, 8e+08 (nrow, ncol, ncell)
resolution : 0.009, 0.009 (x, y)
extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=clrk66 +no_defs
data source : /home/nobackup/rowlings/Downloads/fceurope/europe/w001001.adf
names : w001001
values : 1, 6 (min, max)
Raster Attribute Table
fields : ID COUNT
min : 1 129626
max : 6 4963775
Run Code Online (Sandbox Code Playgroud)
但我在名称和全球范围内的'欧洲'之间略有混淆.它也是一个非常大的光栅.啊,它让欧洲处于不利地位.请注意,投影现在是拉长的.您可能希望在将网格放在一起之前将网格细化,以便从其中给出的所有文件创建全局栅格.
| 归档时间: |
|
| 查看次数: |
980 次 |
| 最近记录: |