【发布时间】:2016-01-26 08:25:56
【问题描述】:
使用 R 基础图,我可以使用以下命令绘制任何 geotiff:
library("raster")
plot(raster("geo.tiff"))
例如,下载this数据,我会这样做:
setwd("C:/download") # same folder as the ZIP-File
map <- raster("smr25musterdaten/SMR_25/SMR_25KOMB_508dpi_LZW/SMR25_LV03_KOMB_Mosaic.tif")
你如何在 ggplot2 中绘制 GeoTif 文件?
编辑:
1:我已将示例文件中的灰度图替换为彩色图,以说明缺少颜色表的问题。
2:在 Pascals 回答的帮助下,我能够适应和改进 this solution 并使输入 tif 更加动态。我将在下面发布答案。
【问题讨论】:
-
使用您的示例,我在
map@legend@colortable中获得了一个颜色表(266 个值)。你的操作系统和sessionInfo是什么? -
@Pascal:昨天一定很晚了。
map@legend@colortable有效,colortable(map)也有效。