今天是个好日子,
使用下面的代码,我可以用成功检索谷歌栅格ggmap,绘制的annotation_raster使用ggplot2,情节和地方网站上的光栅层的顶部红点.在情节上,位置不太匹配(它们应该沿着海岸线).我知道我的网站的位置是正确的,因为当我将数据作为KML文件上传到Google地球时,它们会描绘出应该存在的位置.
建议将不胜感激.
此代码将按原样运行...请注意,您需要一个开发版本ggplot2,可在github上使用.安装:
# install.packages("devtools")
library(devtools)
install_github("ggplot2")
Run Code Online (Sandbox Code Playgroud)
并为代码:
library(ggplot2)
library(ggmap)
library(grDevices)
theme_set(theme_bw())
# Some coordinates of points to plot:
siteLat = c(-22.94414, -22.67119, -29.25241, -30.31181, -32.80670, -33.01054, -32.75833, - 33.36068, -31.81708, -32.09185, -32.31667, -34.13667, -34.05016, -33.91847, -34.13525, -34.12811, -34.10399, -34.16342, -34.41459, -34.58786, -34.83353, -34.37150, -34.40278, -34.17091, -34.08565, -34.04896, -33.98066, -34.02448, -34.20667, -34.05889, -33.97362, -33.99125, -33.28611, -33.02407, -33.01798, -32.99316, -31.09704, -31.05000, -30.91622, -30.70735, -30.28722, -30.27389, -29.86476, -29.54501, -29.49660, -29.28056, -28.80467, -27.42472)
siteLon …Run Code Online (Sandbox Code Playgroud)