概述
Uber H3
H3是一个针对地球的空间划分和空间索引系统。
The H3 geospatial indexing system is a discrete global grid system consisting of a multi-precision hexagonal tiling of the sphere with hierarchical indexes. The hexagonal grid system is created on the planar faces of a sphere-circumscribed icosahedron, and the grid cells are then projected to the surface of the sphere using an inverse face-centered polyhedral gnomonic projection.
名词解释
Icosahedron(正二十面体)
正二十面体(Regular twenty aspect) 是由20个等边三角形所组成的正多面体,共有12个顶点,30条棱,20个面。为五个柏拉图多面体之一。
In geometry, an icosahedron is a polyhedron with 20 faces.
Hexagons(正六边形)
正六边形就是在平面几何学中,具有六条相等的边和六个相等内角的多边形。各内角相等,六边相等。由多边形外角和等于360度,推出一个内角为180-(360/6)=120度,所以内角为120度。
Gnomonic projection
It views the the surface data from the center of the earth.
- The gnomonic map projection displays all great circles as straight lines.
- The least distortion occurs at the tangent point.
- Less than half of the sphere can be projected onto a finite map.
- Since Meridians and the Equator are great circles, they are always shown as straight lines.
dymaxion projection(Fuller Map)
用一个正二十面体内切地球,并且是多面体的顶点均映射到海洋区域,然后将地球使用Gnomonic projection 投影到多面体上,将多面体展成一个平面,保证大陆不会被分裂开。
A map of the Earth which presents geographic information in a single, comprehensive picture without breaks in any of the continental contours, or any visiUberble distortion of the relative shapes or sizes of the land masses.
A world projection with negligible distortion which can accurately display at a glance global information such as human migration patterns and the distribution of natural resources.
Dymaxion = Dynamic + Maximum + Tension = 'Doing More With Less'
理论讲解
投影
For map projection, we chose to use gnomonic projections centered on icosahedron faces. This projects from Earth as a sphere to an icosahedron, a twenty-sided platonic solid. An icosahedron-based map projection results in twenty separate two-dimensional planes rather than a single plane. The icosahedron can be unfolded in many ways, producing a two-dimensional map each time. H3, however, does not unfold the icosahedron to build its grid system, and instead lays its grid out on the icosahedron faces themselves, forming a geodesic discrete global grid system.
单元格(cell shape)
Using a hexagon as the cell shape is critical for H3
H3 used to create a grid on a single icosahedron face.
The H3 grid is constructed by laying out 122 base cells over the Earth, with ten cells per face. Some cells are contained by more than one face. Since it is not possible to tile the icosahedron with only hexagons, we chose to introduce twelve pentagons, one at each of the icosahedron vertices. These vertices were positioned using the spherical icosahedron orientation by R. Buckminster Fuller, which places all the vertices in the water. This helps avoid pentagons surfacing in our work.
细分
H3 enables the user to subdivide areas into smaller and smaller hexagons
H3 supports sixteen resolutions. Each finer resolution has cells with one seventh the area of the coarser resolution. Hexagons cannot be perfectly subdivided into seven hexagons, so the finer cells are only approximately contained within a parent cell.
The identifiers for these child cells can be easily truncated to find their ancestor cell at a coarser resolution, enabling efficient indexing.
Resolution
Each subsequent resolution beyond resolution 0 is created using an aperture 7 resolution spacing (aperture refers to the number of cells in the next finer resolution grid for each cell); as resolution increases the unit length is scaled by \(\sqrt{7}\) and each hexagon has \(1/7th\) the area of a hexagon at the next coarser resolution (as measured on the icosahedron). H3 provides 15 finer grid resolutions in addition to the resolution 0 base cells. The finest resolution, resolution 15, has cells with an area of less than 1 \(m^2\). A table detailing the average cell area for each H3 resolution is available here.
| H3 Resolution | Average Hexagon Area (km2) | Average Hexagon Edge Length (km) | Number of unique indexes |
| 0 | 4,250,546.8477000 | 1,107.712591000 | 122 |
| 1 | 607,220.9782429 | 418.676005500 | 842 |
| 2 | 86,745.8540347 | 158.244655800 | 5,882 |
| 3 | 12,392.2648621 | 59.810857940 | 41,162 |
| 4 | 1,770.3235517 | 22.606379400 | 288,122 |
| 5 | 252.9033645 | 8.544408276 | 2,016,842 |
| 6 | 36.1290521 | 3.229482772 | 14,117,882 |
| 7 | 5.1612932 | 1.220629759 | 98,825,162 |
| 8 | 0.7373276 | 0.461354684 | 691,776,122 |
| 9 | 0.1053325 | 0.174375668 | 4,842,432,842 |
| 10 | 0.0150475 | 0.065907807 | 33,897,029,882 |
| 11 | 0.0021496 | 0.024910561 | 237,279,209,162 |
| 12 | 0.0003071 | 0.009415526 | 1,660,954,464,122 |
| 13 | 0.0000439 | 0.003559893 | 11,626,681,248,842 |
| 14 | 0.0000063 | 0.001348575 | 81,386,768,741,882 |
| 15 | 0.0000009 | 0.000509713 | 569,707,381,193,162 |
Pentagon
Note that it is impossible to tile the sphere/icosahedron completely with hexagons; each resolution of an icosahedral hexagon grid must contain exactly 12 pentagons at every resolution, with one pentagon centered on each of the icosahedron vertices.
Rotated
Each grid resolution is rotated ~19.1° relative to the next coarser resolution. The rotation alternates between counterclockwise and clockwise at each successive resolution, so that each resolution will have one of two possible orientations: Class II or Class III (using a terminology coined by R. Buckminster Fuller). The base cells, which make up resolution 0, are Class II.
编码
The H3 system assigns a unique hierarchical index to each cell. The H3 index of a resolution r cell begins with the appropriate resolution 0 base cell number. This is followed by a sequence of r digits 0-6, where each ith digit di specifies one of the 7 cells centered on the cell indicated by the coarser resolution digits d1 through di-1.
Base cell number
The first H3 resolution (resolution 0) consists of 122 cells (110 hexagons and 12 icosahedron vertex-centered pentagons), referred to as the base cells. These were chosen to capture as much of the symmetry of the spherical icosahedron as possible. These base cells are assigned numbers from 0 to 121 based on the latitude of their center points; base cell 0 has the northern most center point, while base cell 121 has the southern most center point.
Resolution(N>0) cell number
A local hexagon coordinate system is assigned to each of the resolution 0 base cells and is used to orient all hierarchical indexing child cells of that base cell. The assignment of digits 0-6 at each resolution uses a Central Place Indexing arrangement. In the case of the 12 pentagonal cells the indexing hierarchy produced by sub-digit 1 is removed at all resolutions.
Child hexagons are linearly smaller than their parent hexagons.
Discrete hexagon planar grid systems naturally have 3 coordinate axes spaced 120° apart. We refer to such a system as an ijk coordinate system, for the three coordinate axes i, j, and k.
Bit layout of H3Index
The H3Index is the integer representation of an H3 index.
The layout of an H3Index is shown below in table form. The interpretation of the "Reserved/edge" field differs depending on the mode of the index.
| 0x300F | 0x300E---0x300B | 0x300A---0x3008 | 0x3007----0x3004 | 0x3003---0x200D | 0x200C---0x0000 |
| Mode | Reserved/edge | Resolution | Base cell | Digit 1----Digit 15 |
Mode: Mode 1 is an H3 Cell (Hexagon) Index, mode 2 is an H3 Unidirectional Edge (Hexagon A -> Hexagon B) Index, mode 3 is planned to be a bidirectional edge (Hexagon A <-> Hexagon B). Mode 0 is reserved and indicates an invalid H3 index.
mode 1(0x300A---0x3008):3 bits reserved,
mode 2(0x300A---0x3008):3 bits to indicate the edge 1-6 of the cell to traverse,
缺点
Distortion
Because the children cells are only approximately contained, the truncation process produces a fixed amount of shape distortion. This distortion is only present when performing truncation of a cell identifier; when indexing locations at a specific resolution, the cell boundaries are exact.
Distortion
个人感觉,由于H3不是一个完美的数学模型,而是一个地理模型,因此在真正的实现中,使用了大量的固定映射表格,如正二十面体的面的位置,base cell的序号已经他们的邻接关系等;
实现说明
The H3 indexing system is open source and available on GitHub. The H3 library itself is written in C, and bindings are available for a number of languages. Using bindings is the recommended way to start using H3. Uber has published bindings for Java and JavaScript, and the community has contributed bindings for more languages. Bindings are coming soon for Python and Go.
Index
Neighboring
Compact
Edge
应用领域
Traffic Analysis
Geospatial sharding
Geographic Visualization