# H3:六边形层次地理空间索引系统
[](https://github.com/uber/h3/actions)
[](https://github.com/uber/h3/actions)
[](https://github.com/uber/h3/actions)
[](https://github.com/uber/h3/actions)
[](https://coveralls.io/github/uber/h3?branch=master)
[](LICENSE)
H3 是一个使用六边形网格的地理空间索引系统,它可以(近似地)细分为越来越精细的六边形网格,结合了六边形网格的优势与 [S2](https://code.google.com/archive/p/s2-geometry-library/) 的层次细分特性。
文档可在 [https://h3geo.org/](https://h3geo.org/) 获取。Markdown 格式的开发者文档可在 [dev-docs](./dev-docs/) 目录下获取。
* 将 **错误报告或功能请求** 发布到 [GitHub Issues 页面](https://github.com/uber/h3/issues)
* 通过在 [StackOverflow 上的 H3 标签](https://stackoverflow.com/questions/tagged/h3) 发帖来 **提问**
* 还有一个 [H3 Slack 工作区](https://join.slack.com/t/h3-core/shared_invite/zt-g6u5r1hf-W_~uVJmfeiWtMQuBGc1NNg)
## 安装
如果您的编程语言有预构建的绑定可用,我们建议使用它们。[Java](https://github.com/uber/h3-java)、[JavaScript](https://github.com/uber/h3-js)、[Python](https://github.com/uber/h3-py) 和 [其他语言](https://h3geo.org/docs/community/bindings) 的绑定均可使用。
在 macOS 上,您可以使用 `brew` 安装 H3:
```
brew install h3
```
否则,要从源代码构建 H3,请查看以下说明。
### 从源代码构建
还在看这里?要构建 H3 C 库,您需要一个 C 编译器(已使用 `gcc` 和 `clang` 测试过)、[CMake](https://cmake.org/) 和 [Make](https://www.gnu.org/software/make/)。如果您打算为 H3 做贡献,您必须安装 [clang-format](https://clang.llvm.org/docs/ClangFormat.html),我们建议安装 [ccmake](https://cmake.org/cmake/help/v3.0/manual/ccmake.1.html) 和 [LCOV](http://ltp.sourceforge.net/coverage/lcov.php) 来配置 `cmake` 参数,以构建和运行测试并生成代码覆盖率报告。我们也建议使用 `gcc` 来生成代码覆盖率,因为某些版本的 `clang` 生成的注解与 `lcov` 不兼容。需要使用 [Doxygen](https://www.doxygen.nl/index.html) 来构建 API 文档。
#### 安装构建时依赖
* Alpine
```
# 安装最基本的 build requirements
apk add cmake make gcc libtool musl-dev
```
* Debian/Ubuntu
```
# 安装最基本的 build requirements
sudo apt install cmake make gcc libtool
# 安装用于开发的有用工具
sudo apt install clang-format cmake-curses-gui lcov doxygen
```
* macOS(使用 `brew`)
首先确保您 [已安装开发者工具](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/),然后
```
# 安装最基本的 build requirements
brew install cmake
# 安装用于开发的有用工具
brew install clang-format lcov doxygen
```
* Windows(Visual Studio)
您需要安装 CMake 和 Visual Studio,包括 Visual C++ 编译器。要在 Windows 上构建,请遵循 [Windows 构建说明](dev-docs/build_windows.md)。
* FreeBSD
```
# 安装 build requirements
sudo pkg install bash cmake gmake doxygen lcov
```
#### 编译
在检出 H3 Git 仓库时,默认情况下您将检出最新的 H3 开发版本。在应用程序中使用 H3 时,您需要检出最新发布的版本:
```
git checkout v$(
标签:Bash脚本, CMS安全, GIS, H3, JavaScript, LBS, Python, S2几何, Uber, 位置服务, 六边形网格, 地图开发, 地理信息系统, 地理数据处理, 地理空间, 地理编码, 客户端加密, 层次划分, 开源, 无后门, 空间分析, 空间数据库, 空间数据结构, 空间索引, 算法, 网格系统, 计算机科学