【问题标题】:how to overlay the cernatin point value in levelplot using R?如何使用 R 覆盖 levelplot 中的 cernatin 点值?
【发布时间】:2017-01-31 04:34:50
【问题描述】:

我有栅格 (DEM)

class       : RasterLayer 
dimensions  : 164, 96, 15744  (nrow, ncol, ncell)
resolution  : 0.0002777778, 0.0002777778  (x, y)
extent      : 83.47915, 83.50582, 28.80114, 28.84669  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
data source : in memory
names       : layer 
values      : -4.737531, 0.554273  (min, max)

我想覆盖点值

p = -3.9837500 -2.6327150 -1.4857878 -1.0200000 -0.7716000

在以下经纬度

lat=28.80046, 28.80381, 28.81314, 28.81314, 28.81144
lon=83.49621, 83.49524, 83.49450, 83.49450, 83.49201

【问题讨论】:

  • 你做过什么样的搜索?当然,您当前的软件包正在生成的任何图形输出上都有绘制点的示例。是的。
  • 我确实使用'plot'命令进行了绘图并且它有效。但我需要使用 rasterVis 包中的 'levelplot' 进行绘图。

标签: r raster levelplot


【解决方案1】:

制作一个空间点数据框;

p = -3.9837500 -2.6327150 -1.4857878 -1.0200000 -0.7716000
lat=28.80046, 28.80381, 28.81314, 28.81314, 28.81144
lon=83.49621, 83.49524, 83.49450, 83.49450, 83.49201

df <- data.frame(lat = lat, lon= lon, z = p)
coordinates(df) <- ~lon+lat
crs(df) <- projection(yourRas)

并使用“sp.points”添加到 rasterVis 图

levelplot(yourRas) +
    layer(sp.points(df, size=3))

【讨论】:

    猜你喜欢
    • 2016-09-22
    • 1970-01-01
    • 2023-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多