【问题标题】:How to read in a raster and incorporate reference data in .aux.xml, .tfw etc?如何读取光栅并将参考数据合并到 .aux.xml、.tfw 等?
【发布时间】:2017-11-29 20:43:51
【问题描述】:

我有一个 tif,我正在尝试使用分配的投影/基准/等读取。这些是从 ArcMap 导出的 tif,带有包含投影信息的 .tif.xml 和 .tfw 文件。 R中有没有办法用.tif引入分配的coord.ref

读入TIF

r<-'example.tif' 
r <- raster(r)
r

输出

class       : RasterLayer 
dimensions  : 199, 695, 138305  (nrow, ncol, ncell)
resolution  : 50000, 50000  (x, y)
extent      : -17367529, 17382471, -4692230, 5257770  (xmin, xmax,ymin, ymax)
coord. ref. : NA 
data source : in memory
names       : layer 
values      : 0.268264, 5.886104  (min, max)

我知道投影信息包含在相关文件中:.aux.xml、.tfw、.tif.xml。

我正在寻找有效地将其分配给 tif 的最佳方法?

tif 和相关元数据文件的名称是 ArcMap 导出设置和生成的约定。该目录也是共享的。

【问题讨论】:

  • 您好,我也陷入了这个问题,您是否找到了一种方法来合并这些文件并通过图片或其他可见方式从中读取信息?
  • 我最终通过 CRS 使用我知道文件应该是的投影字符串分配投影:类似于:“equalArea

标签: r-raster arcmap rgdal


【解决方案1】:

投影通常直接存储在 tif 中(作为 geotiff)。似乎 arcMAP 也将其存储在 .tif.xml 中,但我真的不知道为什么,因为它没有必要。无论如何,您可以尝试以下方法:

1) 找到你的投影。 proj4string 或 EPSG (http://spatialreference.org)

2) 将其分配给您的栅格:proj4string(r) &lt;- CRS("+init=EPSG:4326")

如果您分配的投影是数据所在的真实投影,则可以。

【讨论】:

    猜你喜欢
    • 2023-01-19
    • 2019-12-15
    • 1970-01-01
    • 2015-01-05
    • 1970-01-01
    • 1970-01-01
    • 2019-12-04
    • 1970-01-01
    • 2017-05-27
    相关资源
    最近更新 更多