r [sf] 如何启用 GEOS 支持?

r [sf] How to enable GEOS support?

我正在尝试按照示例 here 使用 sf 包转换跨越日期变更线的多边形的 CRS,但收到警告

警告信息:

In CPL_wrap_dateline(x, options, quiet) :
  GDAL Error 6: GEOS support not enabled.

这会导致代码的最后一部分失败:

library(sf)
#Linking to GEOS 3.6.1, GDAL 2.1.3, proj.4 4.9.3

point1 <- st_point(c(-179.5, -50))
point2 <- st_point(c(0, -30))
points <- st_sfc(point1, point2, crs = 4236)

points_trans <- st_transform(points, 32621)
circles <- st_buffer(points_trans, 100000)
circles_latlon <- st_transform(circles, 4326)
circles_latlon2 <- st_wrap_dateline(circles_latlon, options = c("WRAPDATELINE=YES"))

我在网上查看了如何启用 GEOS 支持(或者可能只是更新 GDAL),但找不到简单的解释。有什么建议吗?

我是 运行 MACOS 10.13.6; R 3.5.0(也用 3.5.1 检查过,但问题相同)。

我终于通过

解决了这个问题
  1. 正在从 here
  2. 下载并安装更新的 GDAL 和 GEOS 库
  3. 正在从 cran
  4. 下载 sf 的源文件
  5. (重新)安装 sf 使用 R CMD INSTALL sf_0.6-3.tar.gz --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/Versions/2.2/unix/bin/gdal-config -with-geos-config=/Library/Frameworks/GEOS.framework/Versions/3B/unix/bin/geos-config'。请注意,我需要(重新)添加 .gz 扩展名,因为苹果方便地隐藏了它。