根据模拟数据,我创建了指示危险的栅格文件,即危险图:
library(raster)
rockfall_intensity <- raster (xmn = 696583.6, xmx = 696799.6, ymn = 167579.6, ymx = 167789.6, res = 2,
crs = "+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs")
# average kinetic energy per raster cell
rockfall_intensity <- rasterize(trjct[, c('x', 'y')], rockfall_intensity, trjct$Etot, fun = mean)
plot(rockfall_intensity, col=brewer.pal(9,"YlOrRd"))
我想下载此区域的卫星图像(并将栅格固定在顶部)。我查看了get_map
函数
??get_map
mapImageData3 <- get_map(location = c(lon = -7.439583333333333, lat = 46.95240555555556),
color = "color",
source = "google",
maptype = "roadmap",
zoom = 16)
ggmap(mapImageData3,
extent = "device",
ylab = "Latitude",
xlab = "Longitude")
Theme element panel.border missing
Error in if (theme$panel.ontop) { : argument is of length zero
In addition: Warning message:
`panel.margin` is deprecated. Please use `panel.spacing` property instead
如何修复错误? 这有更好的方法吗?
答案 0 :(得分:1)
这里有一些问题:
例如:
mapImageData3 <- get_map(location = c(lon = -7.43958, lat = 46.95241),
color = "color", source = "google",
maptype = "satellite", zoom = 7)
ggmap(mapImageData3, extent = "normal", ylab = "Lattitude",
xlab = "Longitude")