H3：空间索引精度

1：将整个空间分为大量的六边形格子，每个格子对应一个空间索引，那么对于任何一个位置的点必然会落在某一个格子里，也就会按照经纬度建立起了空间索引

2：知道了经纬度，计算出当前位置空间索引，以及相邻格子索引，如果当前位置空间索引里找不到合适的（一些过滤条件），就扩充到相邻索引，当前索引已记录

3：选择六边形的原因是相邻索引只有6个，三角形和四边形都多余6个，相邻索引越少越好，再慢慢层级扩大，这样就能兼顾距离尽可能较近

``` /*
* The following functions provide meta information about the H3 hexagons at
* each zoom level. Since there are only 16 total levels, these are current
* handled with hardwired static values, but it may be worthwhile to put these
* static values into another file that can be autogenerated by source code in
* the future.
*/

double H3_EXPORT(hexAreaKm2)(int res) {
static const double areas[] = {
4250546.848, 607220.9782, 86745.85403, 12392.26486,
1770.323552, 252.9033645, 36.1290521,  5.1612932,
0.7373276,   0.1053325,   0.0150475,   0.0021496,
0.0003071,   0.0000439,   0.0000063,   0.0000009};
return areas[res];
}

double H3_EXPORT(hexAreaM2)(int res) {
static const double areas[] = {
4.25055E+12, 6.07221E+11, 86745854035, 12392264862,
1770323552,  252903364.5, 36129052.1,  5161293.2,
737327.6,    105332.5,    15047.5,     2149.6,
307.1,       43.9,        6.3,         0.9};
return areas[res];
}

double H3_EXPORT(edgeLengthKm)(int res) {
static const double lens[] = {
1107.712591, 418.6760055, 158.2446558, 59.81085794,
22.6063794,  8.544408276, 3.229482772, 1.220629759,
0.461354684, 0.174375668, 0.065907807, 0.024910561,
0.009415526, 0.003559893, 0.001348575, 0.000509713};
return lens[res];
}

double H3_EXPORT(edgeLengthM)(int res) {
static const double lens[] = {
1107712.591, 418676.0055, 158244.6558, 59810.85794,
22606.3794,  8544.408276, 3229.482772, 1220.629759,
461.3546837, 174.3756681, 65.90780749, 24.9105614,
9.415526211, 3.559893033, 1.348574562, 0.509713273};
return lens[res];
}

/** @brief Number of unique valid H3Indexes at given resolution. */
int64_t H3_EXPORT(numHexagons)(int res) {
static const int64_t nums[] = {122L,
842L,
5882L,
41162L,
288122L,
2016842L,
14117882L,
98825162L,
691776122L,
4842432842L,
33897029882L,
237279209162L,
1660954464122L,
11626681248842L,
81386768741882L,
569707381193162L};
return nums[res];
}```

double H3_EXPORT(hexAreaKm2)(int res)：记录的是单个六边形的大小，单位是KM * KM

double H3_EXPORT(hexAreaM2)(int res)：记录的是单个六边形的大小，单位是M * M

double H3_EXPORT(edgeLengthKm)(int res)：记录的是单个六边形的边长，单位是KM

double H3_EXPORT(edgeLengthM)(int res)：记录的是单个六边形的边长，单位是M

int64_t H3_EXPORT(numHexagons)(int res)：记录的是全球六边形的总数，也就是空间索引的总数