rgdal_1.5-15在 R 中安装时出现以下错误(我使用的是 Ubuntu 18.04.4 LTS GNU/Linux 4.15.0-112-generic x86_64):
projectit.cpp:159:6: error: conflicting declaration of C function ‘SEXPREC* transform_ng(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)’
SEXP transform_ng(SEXP fromargs, SEXP toargs, SEXP coordOp, SEXP npts, SEXP x, SEXP y, SEXP z SEXP aoi) {
^~~~~~~~~~~~
In file included from projectit.cpp:11:0:
rgdal.h:132:6: note: previous declaration ‘SEXPREC* transform_ng(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)’
SEXP transform_ng(SEXP fromargs, SEXP toargs, SEXP coordOp, SEXP npts, SEXP x, SEXP y, SEXP z, SEXP aoi); // …Run Code Online (Sandbox Code Playgroud) 我正在尝试在除经纬度以外的任何投影中使用geom_sf()绘制多边形。
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
Run Code Online (Sandbox Code Playgroud)
从latlong转换为epsg:3857
nc_3857 <- sf::st_transform(nc, "+init=epsg:3857")
Run Code Online (Sandbox Code Playgroud)
最后使用ggplot2进行绘图,以定义绘图的crs:
ggplot() +
geom_sf(data = nc_3857, colour = "red", fill = NA) +
coord_sf(crs=st_crs(3857))
Run Code Online (Sandbox Code Playgroud)
我在纬向长轴的wgs84(即epsg:4326)中不断获取地图。我想要以米为单位的轴,因此需要ggplot绘制投影的多边形。我究竟做错了什么?
预先感谢zé