【问题标题】:How to install "h3" library for H3 geospatial indexing system in R如何在 R 中为 H3 地理空间索引系统安装“h3”库
【发布时间】:2021-02-14 01:08:58
【问题描述】:

我的理解是,“H3地理空间索引系统”是Uber开发的一种“坐标系统”,其主要特点是它基于一个层次六边形的系统。 “he”是 R 中的一个库,可以帮助人们处理“H3 空间参考系统”中的数据,但它不存储在 CRAN 中,而是存储在 GitHub (https://github.com/crazycapivara/h3-r) 中。

但是,我无法在 R 中安装此库。我已将其放入托盘中(按照 GitHub 中的说明):

install.packages("devtools")
devtools::install_github("crazycapivara/h3-r")

但它不起作用,并且正在返回此消息:

devtools::install_github("crazycapivara/h3-r")
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
 there is no package called ‘digest’

然后,我执行了相同的步骤,但在“R-cloud”中得到了不同的错误:

h3_hex-ring.cpp:2:22: fatal error: h3/h3api.h: No such file or directory
compilation terminated.
/opt/R/4.0.3/lib/R/etc/Makeconf:181: recipe for target 'h3_hex-ring.o' failed
make: *** [h3_hex-ring.o] Error 1
ERROR: compilation failed for package ‘h3’
* removing ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/4.0/h3’
Error: Failed to install 'h3' from GitHub:
  (converted from warning) installation of package ‘/tmp/RtmpzwLngc/file1698ded56/h3_3.3.2.tar.gz’ had non-zero exit status

我查看了那个 GitHub,但我无法找出问题所在。有没有人在 R 上成功安装了这个库或者知道不同的库可以在这种空间参考系统上工作?

【问题讨论】:

  • 您是否按照 github 自述文件页面上“要求”下列出的步骤进行操作?如果是这样,这些命令的输出是什么?要解决有关“摘要”不可用的错误消息,请先尝试自己运行 install.packages("digest")

标签: r spatial uber-api h3


【解决方案1】:

您的直接问题是您似乎需要在安装 h3-r 之前安装依赖包“digest”(可能还有其他)。首先尝试这样做(我假设您也能够构建底层 C 包)。

我不确定h3-r 的维护有多积极,因此它可能无法与最近发布的 R 配合使用。如果您想尝试通过 js transpile 在 R 中使用 H3,请尝试 https://github.com/obrl-soil/h3jsr(免责声明:我'我是作者)。它可能会在处理非常大的数据集时遇到困难,但对于大多数较小的应用程序来说应该没问题。

【讨论】:

    猜你喜欢
    • 2019-02-02
    • 2018-06-22
    • 2023-03-26
    • 1970-01-01
    • 2023-03-11
    • 2021-12-16
    • 2019-11-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多