小编ze *_*uel的帖子

安装 rgdal 时“目标‘projectit.o’的配方失败”

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)

r rgdal

6
推荐指数
1
解决办法
231
查看次数

使用geom_sf()绘制带有lat-long以外的任何投影的sf对象

我正在尝试在除经纬度以外的任何投影中使用geom_sf()绘制多边形。

我使用在手册页中找到的示例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é

r axes ggplot2 map-projections r-sf

3
推荐指数
2
解决办法
1825
查看次数

标签 统计

r ×2

axes ×1

ggplot2 ×1

map-projections ×1

r-sf ×1

rgdal ×1