h3 3.5.0 → 3.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +45 -0
  3. data/Gemfile.lock +9 -7
  4. data/README.md +8 -8
  5. data/ext/h3/src/.github/workflows/test-linux.yml +118 -0
  6. data/ext/h3/src/.github/workflows/test-macos.yml +42 -0
  7. data/ext/h3/src/.github/workflows/test-website.yml +32 -0
  8. data/ext/h3/src/.github/workflows/test-windows.yml +44 -0
  9. data/ext/h3/src/.gitignore +5 -0
  10. data/ext/h3/src/.travis.yml +21 -32
  11. data/ext/h3/src/CHANGELOG.md +60 -0
  12. data/ext/h3/src/CMakeLists.txt +150 -33
  13. data/ext/h3/src/CONTRIBUTING.md +1 -1
  14. data/ext/h3/src/README.md +65 -16
  15. data/ext/h3/src/RELEASE.md +3 -1
  16. data/ext/h3/src/VERSION +1 -1
  17. data/ext/h3/src/dev-docs/RFCs/rfc-template.md +21 -0
  18. data/ext/h3/src/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +21 -0
  19. data/ext/h3/src/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md +276 -0
  20. data/ext/h3/src/dev-docs/RFCs/v4.0.0/overrideable-allocators-rfc.md +141 -0
  21. data/ext/h3/src/dev-docs/RFCs/v4.0.0/polyfill-modes-rfc.md +21 -0
  22. data/ext/h3/src/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md +50 -0
  23. data/ext/h3/src/dev-docs/build_windows.md +6 -1
  24. data/ext/h3/src/dev-docs/creating_bindings.md +3 -3
  25. data/ext/h3/src/dev-docs/custom_alloc.md +27 -0
  26. data/ext/h3/src/docs/{overview/mainpage.md → README.md} +2 -3
  27. data/ext/h3/src/docs/api/hierarchy.md +8 -0
  28. data/ext/h3/src/docs/api/misc.md +94 -0
  29. data/ext/h3/src/docs/community/applications.md +1 -0
  30. data/ext/h3/src/docs/community/bindings.md +10 -0
  31. data/ext/h3/src/docs/community/tutorials.md +8 -3
  32. data/ext/h3/src/docs/core-library/coordsystems.md +5 -4
  33. data/ext/h3/src/docs/core-library/filters.md +8 -9
  34. data/ext/h3/src/docs/core-library/geoToH3desc.md +2 -3
  35. data/ext/h3/src/docs/core-library/h3ToGeoBoundaryDesc.md +4 -5
  36. data/ext/h3/src/docs/core-library/h3ToGeoDesc.md +3 -4
  37. data/ext/h3/src/docs/core-library/h3indexing.md +26 -17
  38. data/ext/h3/src/docs/core-library/overview.md +2 -3
  39. data/ext/h3/src/docs/core-library/restable.md +1 -2
  40. data/ext/h3/src/docs/core-library/usage.md +1 -2
  41. data/ext/h3/src/docs/table-of-contents.json +47 -0
  42. data/ext/h3/src/docs/{overview/usecases.md → usecases.md} +6 -11
  43. data/ext/h3/src/scripts/binding_functions.sh +1 -1
  44. data/ext/h3/src/scripts/coverage.sh.in +8 -4
  45. data/ext/h3/src/scripts/update_version.sh +2 -2
  46. data/ext/h3/src/src/apps/applib/include/args.h +1 -0
  47. data/ext/h3/src/src/apps/applib/include/test.h +1 -0
  48. data/ext/h3/src/src/apps/applib/include/utility.h +7 -1
  49. data/ext/h3/src/src/apps/applib/lib/args.c +2 -0
  50. data/ext/h3/src/src/apps/applib/lib/kml.c +2 -0
  51. data/ext/h3/src/src/apps/applib/lib/test.c +1 -0
  52. data/ext/h3/src/src/apps/applib/lib/utility.c +133 -2
  53. data/ext/h3/src/src/apps/benchmarks/benchmarkH3Api.c +1 -1
  54. data/ext/h3/src/{website/html.config.js → src/apps/benchmarks/benchmarkH3UniEdge.c} +15 -12
  55. data/ext/h3/src/src/apps/filters/h3ToComponents.c +1 -0
  56. data/ext/h3/src/src/apps/filters/h3ToGeo.c +1 -0
  57. data/ext/h3/src/src/apps/filters/h3ToGeoBoundary.c +1 -0
  58. data/ext/h3/src/src/apps/filters/h3ToLocalIj.c +1 -0
  59. data/ext/h3/src/src/apps/filters/hexRange.c +1 -0
  60. data/ext/h3/src/src/apps/filters/kRing.c +1 -0
  61. data/ext/h3/src/src/apps/filters/localIjToH3.c +1 -0
  62. data/ext/h3/src/src/apps/miscapps/generateBaseCellNeighbors.c +2 -2
  63. data/ext/h3/src/src/apps/miscapps/generateFaceCenterPoint.c +1 -0
  64. data/ext/h3/src/src/apps/miscapps/generateNumHexagons.c +1 -2
  65. data/ext/h3/src/src/apps/miscapps/generatePentagonDirectionFaces.c +67 -0
  66. data/ext/h3/src/src/apps/miscapps/h3ToGeoBoundaryHier.c +1 -0
  67. data/ext/h3/src/src/apps/miscapps/h3ToGeoHier.c +1 -0
  68. data/ext/h3/src/src/apps/miscapps/h3ToHier.c +1 -0
  69. data/ext/h3/src/src/apps/testapps/mkRandGeo.c +1 -0
  70. data/ext/h3/src/src/apps/testapps/mkRandGeoBoundary.c +1 -0
  71. data/ext/h3/src/src/apps/testapps/testBBox.c +1 -0
  72. data/ext/h3/src/src/apps/testapps/testBaseCells.c +15 -1
  73. data/ext/h3/src/src/apps/testapps/testCompact.c +121 -2
  74. data/ext/h3/src/src/apps/testapps/testCoordIj.c +1 -0
  75. data/ext/h3/src/src/apps/testapps/testGeoCoord.c +47 -8
  76. data/ext/h3/src/src/apps/testapps/testGeoToH3.c +1 -0
  77. data/ext/h3/src/src/apps/testapps/testH3Api.c +1 -0
  78. data/ext/h3/src/src/apps/testapps/testH3CellArea.c +47 -0
  79. data/ext/h3/src/src/apps/testapps/testH3CellAreaExhaustive.c +180 -0
  80. data/ext/h3/src/src/apps/testapps/testH3Distance.c +2 -50
  81. data/ext/h3/src/src/apps/testapps/testH3DistanceExhaustive.c +84 -0
  82. data/ext/h3/src/src/apps/testapps/testH3GetFaces.c +1 -0
  83. data/ext/h3/src/src/apps/testapps/testH3Index.c +33 -3
  84. data/ext/h3/src/src/apps/testapps/testH3Line.c +2 -84
  85. data/ext/h3/src/src/apps/testapps/testH3LineExhaustive.c +115 -0
  86. data/ext/h3/src/src/apps/testapps/testH3Memory.c +175 -0
  87. data/ext/h3/src/src/apps/testapps/testH3NeighborRotations.c +1 -0
  88. data/ext/h3/src/src/apps/testapps/testH3SetToLinkedGeo.c +1 -0
  89. data/ext/h3/src/src/apps/testapps/testH3SetToVertexGraph.c +1 -0
  90. data/ext/h3/src/src/apps/testapps/testH3ToCenterChild.c +68 -0
  91. data/ext/h3/src/src/apps/testapps/testH3ToChildren.c +15 -2
  92. data/ext/h3/src/src/apps/testapps/testH3ToGeo.c +1 -0
  93. data/ext/h3/src/src/apps/testapps/testH3ToGeoBoundary.c +1 -0
  94. data/ext/h3/src/src/apps/testapps/testH3ToLocalIj.c +24 -236
  95. data/ext/h3/src/src/apps/testapps/testH3ToLocalIjExhaustive.c +265 -0
  96. data/ext/h3/src/src/apps/testapps/testH3ToParent.c +1 -0
  97. data/ext/h3/src/src/apps/testapps/testH3UniEdge.c +45 -16
  98. data/ext/h3/src/src/apps/testapps/testH3UniEdgeExhaustive.c +111 -0
  99. data/ext/h3/src/src/apps/testapps/testHexRanges.c +1 -0
  100. data/ext/h3/src/src/apps/testapps/testHexRing.c +1 -0
  101. data/ext/h3/src/src/apps/testapps/testKRing.c +1 -0
  102. data/ext/h3/src/src/apps/testapps/testLinkedGeo.c +1 -0
  103. data/ext/h3/src/src/apps/testapps/testMaxH3ToChildrenSize.c +1 -0
  104. data/ext/h3/src/src/apps/testapps/testPentagonIndexes.c +58 -0
  105. data/ext/h3/src/src/apps/testapps/testPolyfill.c +72 -9
  106. data/ext/h3/src/src/apps/testapps/testPolyfillReported.c +157 -0
  107. data/ext/h3/src/src/apps/testapps/testPolygon.c +27 -1
  108. data/ext/h3/src/src/apps/testapps/testVec2d.c +1 -0
  109. data/ext/h3/src/src/apps/testapps/testVec3d.c +1 -0
  110. data/ext/h3/src/src/apps/testapps/testVertex.c +66 -0
  111. data/ext/h3/src/src/apps/testapps/testVertexGraph.c +1 -0
  112. data/ext/h3/src/src/h3lib/include/algos.h +8 -0
  113. data/ext/h3/src/src/h3lib/include/alloc.h +40 -0
  114. data/ext/h3/src/src/h3lib/include/baseCells.h +4 -0
  115. data/ext/h3/src/src/h3lib/include/bbox.h +4 -1
  116. data/ext/h3/src/src/h3lib/include/constants.h +2 -0
  117. data/ext/h3/src/src/h3lib/include/faceijk.h +3 -2
  118. data/ext/h3/src/src/h3lib/include/geoCoord.h +2 -3
  119. data/ext/h3/src/src/h3lib/include/h3Index.h +37 -4
  120. data/ext/h3/src/src/h3lib/include/h3api.h.in +85 -17
  121. data/ext/h3/src/src/h3lib/include/linkedGeo.h +1 -0
  122. data/ext/h3/src/src/h3lib/include/polygon.h +1 -0
  123. data/ext/h3/src/src/h3lib/include/polygonAlgos.h +1 -0
  124. data/ext/h3/src/src/h3lib/include/vertex.h +44 -0
  125. data/ext/h3/src/src/h3lib/include/vertexGraph.h +1 -0
  126. data/ext/h3/src/src/h3lib/lib/algos.c +305 -80
  127. data/ext/h3/src/src/h3lib/lib/baseCells.c +26 -4
  128. data/ext/h3/src/src/h3lib/lib/bbox.c +56 -27
  129. data/ext/h3/src/src/h3lib/lib/coordijk.c +2 -0
  130. data/ext/h3/src/src/h3lib/lib/faceijk.c +35 -24
  131. data/ext/h3/src/src/h3lib/lib/geoCoord.c +162 -44
  132. data/ext/h3/src/src/h3lib/lib/h3Index.c +150 -46
  133. data/ext/h3/src/src/h3lib/lib/h3UniEdge.c +42 -57
  134. data/ext/h3/src/src/h3lib/lib/linkedGeo.c +20 -15
  135. data/ext/h3/src/src/h3lib/lib/localij.c +5 -5
  136. data/ext/h3/src/src/h3lib/lib/polygon.c +3 -2
  137. data/ext/h3/src/src/h3lib/lib/vec2d.c +1 -0
  138. data/ext/h3/src/src/h3lib/lib/vec3d.c +1 -0
  139. data/ext/h3/src/src/h3lib/lib/vertex.c +134 -0
  140. data/ext/h3/src/src/h3lib/lib/vertexGraph.c +8 -5
  141. data/ext/h3/src/website/.eslintignore +2 -0
  142. data/ext/h3/src/website/.gitignore +57 -0
  143. data/ext/h3/src/website/.nvmrc +1 -0
  144. data/ext/h3/src/website/README.md +8 -6
  145. data/ext/h3/src/website/gatsby-config.js +83 -0
  146. data/ext/h3/src/website/package.json +20 -12
  147. data/ext/h3/src/website/scripts/build-to-gh-pages.sh +7 -5
  148. data/ext/h3/src/website/src/.gitkeep +0 -0
  149. data/ext/h3/src/website/templates/documentation.jsx +129 -0
  150. data/ext/h3/src/website/yarn.lock +13723 -0
  151. data/h3.gemspec +1 -0
  152. data/lib/h3.rb +8 -23
  153. data/lib/h3/bindings/base.rb +15 -4
  154. data/lib/h3/bindings/private.rb +13 -9
  155. data/lib/h3/geo_json.rb +1 -1
  156. data/lib/h3/hierarchy.rb +24 -9
  157. data/lib/h3/indexing.rb +7 -7
  158. data/lib/h3/inspection.rb +22 -26
  159. data/lib/h3/miscellaneous.rb +157 -9
  160. data/lib/h3/regions.rb +3 -0
  161. data/lib/h3/traversal.rb +9 -9
  162. data/lib/h3/unidirectional_edges.rb +18 -18
  163. data/lib/h3/version.rb +1 -1
  164. data/spec/geo_json_spec.rb +8 -0
  165. data/spec/hierarchy_spec.rb +23 -13
  166. data/spec/indexing_spec.rb +15 -15
  167. data/spec/inspection_spec.rb +17 -17
  168. data/spec/miscellaneous_spec.rb +151 -6
  169. data/spec/{region_spec.rb → regions_spec.rb} +1 -1
  170. data/spec/traversal_spec.rb +6 -6
  171. data/spec/unidirectional_edges_spec.rb +18 -18
  172. metadata +55 -15
  173. data/ext/h3/src/.ycm_extra_conf.py +0 -92
  174. data/ext/h3/src/appveyor.yml +0 -50
  175. data/ext/h3/src/website/src/config.js +0 -46
  176. data/ext/h3/src/website/src/mdRoutes.js +0 -151
  177. data/ext/h3/src/website/src/styles/_variables.scss +0 -16
  178. data/ext/h3/src/website/src/styles/index.scss +0 -3
  179. data/ext/h3/src/website/static/index.html +0 -15
  180. data/lib/h3/bindings.rb +0 -12
@@ -0,0 +1,21 @@
1
+ # RFC: Polyfill modes
2
+
3
+ * **Authors**: -
4
+ * **Date**: -
5
+ * **Status**: Draft
6
+
7
+ ## Abstract
8
+
9
+ Our current polyfill algorithm allocates cells to polygons based on whether the center of the cell falls within the polygon, using Cartesian geometry. This proposal outlines options for expanding the polyfill algorithm to allow for different containment modes (e.g. wholly contained cells, intersecting cells) and spherical geometry.
10
+
11
+ ## Motivation
12
+
13
+ *Why is this important?*
14
+
15
+ ## Approaches
16
+
17
+ *What are the various options to address this issue?*
18
+
19
+ ## Proposal
20
+
21
+ *What is the recommended approach?*
@@ -0,0 +1,50 @@
1
+ # RFC: Vertex mode
2
+
3
+ * **Authors**: Nick Rabinowitz
4
+ * **Date**: -
5
+ * **Status**: Draft
6
+
7
+ ## Abstract
8
+
9
+ This proposal would add a new H3 index mode, Vertex Mode, to provide a canonical id for a vertex in a cell boundary. Each vertex shared by 3 adjacent cells would be represented by a single index.
10
+
11
+ ## Motivation
12
+
13
+ The advantages of this approach:
14
+
15
+ * Shared vertices can be compared between hexagons with a strict equality check
16
+ * Vertices can be represented and stored without the trig calls required to produce a lat/lon point
17
+ * Vertex to lat/lon can be guaranteed to return the same result across different cells that share the vertex
18
+
19
+ At a minimum, this should open up significant performance and correctness gains in `h3SetToLinkedGeo` and `directedEdgeToBoundary`, and there are likely other uses as well.
20
+
21
+ ## Approaches
22
+
23
+ The proposed approach below is fairly straightforward. The main questions are:
24
+
25
+ * Whether to have one vertex mode, `H3_VERTEX_MODE`, representing the 5 or 6 topological vertices of each cell, or whether to additionally offer a second vertex mode, `H3_ICOSAEDGE_VERTEX_MODE`, to represent distortion vertices shared by two cells whose edge crosses an edge of the icosahedron.
26
+
27
+ * If we have two different modes, which functions return both types, in order, and which functions return only one type.
28
+
29
+ These two modes are largely orthogonal, and it would be possible to implement only `H3_VERTEX_MODE` first without considering `H3_ICOSAEDGE_VERTEX_MODE`. This simplifies the implementation and keeps the new mode wholly in the topological space, without considering the geometric issues posed by the distortion vertices. However this may make it harder or more expensive to implement transformations from sets of vertices to the geometry of a polygon or edge.
30
+
31
+ ## Proposal
32
+
33
+ ### Format of the index
34
+
35
+ * The H3 index of the "owner" cell. The owner would be one of the cells that share the vertex (see below).
36
+ * The mode set to `H3_VERTEX_MODE`
37
+ * The reserved bits used to identify the index (0-6) of the vertex on the owner cell, using the index order used by `cellToBoundary`
38
+
39
+ ### Choice of owner
40
+
41
+ Proposed simple algorithm for determining ownership:
42
+
43
+ * Find all three neighbors that share a vertex
44
+ * Use the one with the numerically lowest index as the owner
45
+
46
+ ### New library functions
47
+
48
+ * `void getCellVertexes(H3Index cell, H3Vertex *vertices)`
49
+ * `H3Vertex getCellVertex(H3Index cell, int vertIndex)`
50
+ * `GeoCoord vertexToGeoPoint(H3Vertex vertex)`
@@ -10,9 +10,14 @@ cd build
10
10
  cmake ..
11
11
  ```
12
12
 
13
- You can now open `h3.sln` and build the `ALL_BUILD` project to build the H3 library, filter applications, and tests. Tests can be run by building the `RUN_TESTS` project. From the command line:
13
+ You can now open `h3.sln` and build the `ALL_BUILD` project to build the H3 library, filter applications, and tests. From the command line:
14
14
 
15
15
  ```
16
16
  msbuild ALL_BUILD.vcxproj
17
+ ```
18
+
19
+ Tests can be run by building the `RUN_TESTS` project. Tests require `bash` be available, which is usually supplied by Git for Windows. From the command line:
20
+
21
+ ```
17
22
  msbuild RUN_TESTS.vcxproj
18
23
  ```
@@ -2,13 +2,13 @@
2
2
 
3
3
  H3 is a C library, in part to make it simpler to create bindings for different programming languages. Each language usually has its own way to bind to C functions, but this document can serve as a starting point and list of tips.
4
4
 
5
- There may already be [H3 bindings](https://uber.github.io/h3/#/documentation/community/bindings) available for your language of choice.
5
+ There may already be [H3 bindings](https://h3geo.org/docs/community/bindings) available for your language of choice.
6
6
 
7
7
  ## Function naming
8
8
 
9
9
  The `make binding-functions` target produces a file `binding-functions` containing a list of function in the H3 public API, one per line. You can use this as part of your build process to check how much of the H3 public API your bindings expose. This list does not include memory management functions that are needed to allocate arrays to be passed to the H3 API.
10
10
 
11
- Keeping similar names and purposes for functions can make it easier for your users to use the H3 [API Reference](https://uber.github.io/h3/#/documentation/api-reference/).
11
+ Keeping similar names and purposes for functions can make it easier for your users to use the H3 [API Reference](https://h3geo.org/docs/api/indexing).
12
12
 
13
13
  ## Community
14
14
 
@@ -16,7 +16,7 @@ When ready, make a [pull request](https://github.com/uber/h3/edit/master/docs/co
16
16
 
17
17
  ## Documentation
18
18
 
19
- To be included in the H3 [API reference](https://uber.github.io/h3/#/documentation/api-reference/), your binding should:
19
+ To be included in the H3 [API reference](https://h3geo.org/docs/api/indexing), your binding should:
20
20
 
21
21
  * Be reasonably up to date with uber/h3.
22
22
  * Include bindings for the relevant functions in the output of `make binding-functions`. For example, `stringToH3` may not be necessary if your bindings only supports string H3 indexes.
@@ -0,0 +1,27 @@
1
+ # Custom Memory Allocators
2
+
3
+ H3 supports replacing the memory management functions (`malloc`, `calloc`, `realloc`, `free`) used by the library at build time. This can be used to integrate H3 within a managed framework.
4
+
5
+ When using custom memory allocators, H3 prefixes the names of memory allocation functions with the string you specify. The application linking H3 must have the prefixed replacement functions defined.
6
+
7
+ When building H3, specify the `H3_ALLOC_PREFIX` option to your prefix of choice, as below:
8
+
9
+ ```
10
+ cmake -DH3_ALLOC_PREFIX=my_prefix_ .
11
+ ```
12
+
13
+ Then, in your application using H3, implement the following functions (replacing `my_prefix_` with the prefix you chose above):
14
+
15
+ ```
16
+ void* my_prefix_malloc(size_t size);
17
+ void* my_prefix_calloc(size_t num, size_t size);
18
+ void* my_prefix_realloc(void* ptr, size_t size);
19
+ void my_prefix_free(void* ptr);
20
+ ```
21
+
22
+ Link to H3 as you would have without the custom allocators. The custom allocators will be used for allocating heap memory in H3.
23
+
24
+ ## Notes/Caveats
25
+
26
+ * There are a few algorithms like `kRing` that still use the call stack to recurse and could run out of memory that way.
27
+ * H3 does not currently use `realloc`.
@@ -1,5 +1,4 @@
1
- H3 Core
2
- ---
1
+ # Introduction
3
2
 
4
3
  The **H3** geospatial indexing system is a multi-precision hexagonal tiling of the sphere indexed with hierarchical linear indexes. The **H3 Core Library** provides functions for converting between latitude/longitude coordinates and **H3** geospatial indexes. Specifically, the major library entry point functions (defined in `h3api.h`) provide the functionality:
5
4
 
@@ -8,4 +7,4 @@ The **H3** geospatial indexing system is a multi-precision hexagonal tiling of t
8
7
  * given an **H3** index, determine the cell boundary in latitude/longitude coordinates
9
8
  * and more.
10
9
 
11
- The **H3 Core Library** is written entirely in *C*. <a href="#/documentation/community/bindings">Bindings for other languages</a> are available.
10
+ The **H3 Core Library** is written entirely in *C*. [Bindings for other languages](/docs/community/bindings) are available.
@@ -26,6 +26,14 @@ int maxH3ToChildrenSize(H3Index h, int childRes);
26
26
 
27
27
  Returns the size of the array needed by `h3ToChildren` for these inputs.
28
28
 
29
+ ## h3ToCenterChild
30
+
31
+ ```
32
+ H3Index h3ToCenterChild(H3Index h, int childRes);
33
+ ```
34
+
35
+ Returns the center child (finer) index contained by `h` at resolution `childRes`.
36
+
29
37
  ## compact
30
38
 
31
39
  ```
@@ -34,6 +34,30 @@ double hexAreaM2(int res);
34
34
 
35
35
  Average hexagon area in square meters at the given resolution.
36
36
 
37
+ ## cellAreaKm2
38
+
39
+ ```
40
+ double cellAreaKm2(H3Index h);
41
+ ```
42
+
43
+ Exact area of specific cell in square kilometers.
44
+
45
+ ## cellAreaM2
46
+
47
+ ```
48
+ double cellAreaM2(H3Index h);
49
+ ```
50
+
51
+ Exact area of specific cell in square meters.
52
+
53
+ ## cellAreaRads2
54
+
55
+ ```
56
+ double cellAreaRads2(H3Index h);
57
+ ```
58
+
59
+ Exact area of specific cell in square radians.
60
+
37
61
  ## edgeLengthKm
38
62
 
39
63
  ```
@@ -50,6 +74,31 @@ double edgeLengthM(int res);
50
74
 
51
75
  Average hexagon edge length in meters at the given resolution.
52
76
 
77
+
78
+ ## exactEdgeLengthKm
79
+
80
+ ```
81
+ double exactEdgeLengthKm(H3Index edge);
82
+ ```
83
+
84
+ Exact edge length of specific unidirectional edge in kilometers.
85
+
86
+ ## exactEdgeLengthM
87
+
88
+ ```
89
+ double exactEdgeLengthM(H3Index edge);
90
+ ```
91
+
92
+ Exact edge length of specific unidirectional edge in meters.
93
+
94
+ ## exactEdgeLengthRads
95
+
96
+ ```
97
+ double exactEdgeLengthRads(H3Index edge);
98
+ ```
99
+
100
+ Exact edge length of specific unidirectional edge in radians.
101
+
53
102
  ## numHexagons
54
103
 
55
104
  ```
@@ -65,6 +114,7 @@ void getRes0Indexes(H3Index *out);
65
114
  ```
66
115
 
67
116
  All the resolution 0 **H3** indexes.
117
+ `out` must be an array of at least size `res0IndexCount()`.
68
118
 
69
119
  ## res0IndexCount
70
120
 
@@ -73,3 +123,47 @@ int res0IndexCount();
73
123
  ```
74
124
 
75
125
  Number of resolution 0 **H3** indexes.
126
+
127
+ ## getPentagonIndexes
128
+
129
+ ```
130
+ void getPentagonIndexes(int res, H3Index *out);
131
+ ```
132
+
133
+ All the pentagon **H3** indexes at the specified resolution.
134
+ `out` must be an array of at least size `pentagonIndexCount()`.
135
+
136
+ ## pentagonIndexCount
137
+
138
+ ```
139
+ int pentagonIndexCount();
140
+ ```
141
+
142
+ Number of pentagon **H3** indexes per resolution. This is always 12, but provided as a convenience.
143
+
144
+ ## pointDistKm
145
+
146
+ ```
147
+ double pointDistKm(const GeoCoord *a, const GeoCoord *b);
148
+ ```
149
+
150
+ Gives the "great circle" or "haversine" distance between pairs of
151
+ GeoCoord points (lat/lng pairs) in kilometers.
152
+
153
+ ## pointDistM
154
+
155
+ ```
156
+ double pointDistM(const GeoCoord *a, const GeoCoord *b);
157
+ ```
158
+
159
+ Gives the "great circle" or "haversine" distance between pairs of
160
+ GeoCoord points (lat/lng pairs) in meters.
161
+
162
+ ## pointDistRads
163
+
164
+ ```
165
+ double pointDistRads(const GeoCoord *a, const GeoCoord *b);
166
+ ```
167
+
168
+ Gives the "great circle" or "haversine" distance between pairs of
169
+ GeoCoord points (lat/lng pairs) in radians.
@@ -5,3 +5,4 @@ The following applications use H3. Contributions to this list are welcome, pleas
5
5
  ## Visualization
6
6
 
7
7
  - [kepler.gl](http://kepler.gl/) - An open source geospatial analysis tool
8
+ - [pydeck](https://pydeck.gl/) - High-scale spatial rendering in Python, powered by deck.gl
@@ -2,6 +2,10 @@
2
2
 
3
3
  As a C library, bindings can be made to call H3 functions from different programming languages. This page lists different bindings currently available. Contributions to this list are welcome, please feel free to open a [pull request](https://github.com/uber/h3/tree/master/docs/community/bindings.md).
4
4
 
5
+ ## BigQuery
6
+
7
+ - [cartodb/bigquery-jslibs](https://github.com/CartoDB/bigquery-jslibs)
8
+
5
9
  ## C&#35;
6
10
 
7
11
  - [entrepreneur-interet-general/h3.standard](https://github.com/entrepreneur-interet-general/H3.Standard)
@@ -30,6 +34,7 @@ As a C library, bindings can be made to call H3 functions from different program
30
34
 
31
35
  - [uber/h3-js](https://github.com/uber/h3-js)
32
36
  - [dfellis/h3-node](https://github.com/dfellis/h3-node)
37
+ - [realPrimoh/h3-reactnative](https://github.com/realPrimoh/h3-reactnative)
33
38
 
34
39
  ## Julia
35
40
 
@@ -60,3 +65,8 @@ As a C library, bindings can be made to call H3 functions from different program
60
65
  ## Ruby
61
66
 
62
67
  - [StuartApp/h3_ruby](https://github.com/StuartApp/h3_ruby)
68
+
69
+ ## Rust
70
+
71
+ - [rustyconover/libh3-sys](https://github.com/rustyconover/libh3-sys)
72
+ - [rustyconover/libh3](https://github.com/rustyconover/libh3)
@@ -1,7 +1,11 @@
1
- # Tutorials
1
+ # Learning Resources
2
2
 
3
3
  This page lists further learning materials and code walkthroughs for the H3 library and bindings. Contributions to this list are welcome, please feel free to open a [pull request](https://github.com/uber/h3/tree/master/docs/community/tutorials.md).
4
4
 
5
+ ## Community
6
+
7
+ - [H3 Slack workspace](https://join.slack.com/t/h3-core/shared_invite/zt-g6u5r1hf-W_~uVJmfeiWtMQuBGc1NNg)
8
+
5
9
  ## Videos
6
10
 
7
11
  - [Introduction to H3](https://www.youtube.com/watch?v=wDuKeUkNLkQ) (June 2019)
@@ -24,5 +28,6 @@ This page lists further learning materials and code walkthroughs for the H3 libr
24
28
 
25
29
  ## Python
26
30
 
27
- - [Usage (IPython Notebook)](https://github.com/uber/h3-py/blob/master/docs/Usage.ipynb)
28
- - [Unified Data Layers (IPython Notebook)](https://github.com/uber/h3-py/blob/master/docs/UnifiedDataLayers.ipynb)
31
+ - [Usage (IPython Notebook)](https://github.com/uber/h3-py-notebooks/blob/master/notebooks/usage.ipynb)
32
+ - [Unified Data Layers (IPython Notebook)](https://github.com/uber/h3-py-notebooks/blob/master/notebooks/unified_data_layers.ipynb)
33
+ - [H3 API examples on Urban Analytics(IPython Notebook)](https://github.com/uber/h3-py-notebooks/blob/master/notebooks/urban_analytics.ipynb)
@@ -1,5 +1,6 @@
1
- Coordinate Systems used by the H3 Core Library
2
- ---
1
+ # Coordinate systems
2
+
3
+ The **H3 Core Library** uses the following coordinate systems internally.
3
4
 
4
5
  IJK Coordinates
5
6
  ---
@@ -9,7 +10,7 @@ Discrete hexagon planar grid systems naturally have 3 coordinate axes spaced 120
9
10
  Using an *ijk* coordinate system to address hexagon grid cells provides multiple valid addresses for each cell. *Normalizing* an *ijk* address (function `_ijkNormalize`) creates a unique address consisting of the minimal positive *ijk* components; this always results in at most two non-zero components.
10
11
 
11
12
  <div align="center">
12
- <img height="300" src="images/ijkp.png" />
13
+ <img height="300" src="/images/ijkp.png" />
13
14
  </div>
14
15
 
15
16
  FaceIJK Coordinates
@@ -20,7 +21,7 @@ The **H3 Core Library** centers an *ijk* coordinate system on each face of the i
20
21
  Each grid resolution is rotated ~19.1&deg; 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*.
21
22
 
22
23
  <div align="center">
23
- <img height="300" src="images/classII.III.png" />
24
+ <img height="300" src="/images/classII.III.png" />
24
25
  </div>
25
26
 
26
27
  Hex2d Coordinates
@@ -1,11 +1,10 @@
1
- Unix-style Filters for Address Conversion
2
- ---
1
+ # Unix-style Filters for H3
3
2
 
4
3
  The directory `src/apps/filters` contains unix-style stdin/stdout filters that perform conversions between integer **H3** indexes and other useful types. It currently contains the filters listed in the table below. See the header comments in each application source code file for more information.
5
4
 
6
5
  Filters are experimental and are not part of the semantic version of the H3 library.
7
6
 
8
- All latitude/longitude coordinates are in decimal degrees. See the <a href="#/documentation/core-library/h3-index-representations"> **H3** Index Representations</a> page for information on the integer `H3Index`.
7
+ All latitude/longitude coordinates are in decimal degrees. See the [**H3** Index Representations](/docs/core-library/h3indexing) page for information on the integer `H3Index`.
9
8
 
10
9
 
11
10
  | filter | input | outputs
@@ -22,26 +21,26 @@ Unix Command Line Examples
22
21
 
23
22
  * find the index for coordinates at resolution 5
24
23
 
25
- `echo 40.689167 -74.044444 | geoToH3 5`
24
+ `geoToH3 --resolution 5 --latitude 40.689167 --longitude -74.044444`
26
25
 
27
26
  * output the cell center point for `H3Index` 845ad1bffffffff
28
27
 
29
- `echo 845ad1bffffffff | h3ToGeo`
28
+ `h3ToGeo --index 845ad1bffffffff`
30
29
 
31
30
  * output the cell boundary for `H3Index` 845ad1bffffffff
32
31
 
33
- `echo 845ad1bffffffff | h3ToGeoBoundary`
32
+ `h3ToGeoBoundary --index 845ad1bffffffff`
34
33
 
35
34
  * find the components for the `H3Index` 845ad1bffffffff
36
35
 
37
- `echo 845ad1bffffffff | h3ToComponents`
36
+ `h3ToComponents --index 845ad1bffffffff`
38
37
 
39
38
  * output all indexes within distance 1 of the `H3Index` 845ad1bffffffff
40
39
 
41
- `echo 845ad1bffffffff | kRing 1`
40
+ `kRing -k 1 --origin 845ad1bffffffff`
42
41
 
43
42
  * output all hexagon indexes within distance 2 of the `H3Index` 845ad1bffffffff
44
43
 
45
- `echo 845ad1bffffffff | hexRange 2`
44
+ `hexRange -k 2 --origin 845ad1bffffffff`
46
45
 
47
46
  Note that the filters `h3ToGeo` and `h3ToGeoBoundary` take optional arguments that allow them to generate `kml` output. See the header comments in the corresponding source code files for details.
@@ -1,9 +1,8 @@
1
- Conversion from latitude/longitude to containing H3 cell index
2
- ---
1
+ # Conversion from latitude/longitude to containing H3 cell index
3
2
 
4
3
  This operation is performed by function `geoToH3`. See the comments in the function for more detail.
5
4
 
6
- The conversion is performed as a series of coordinate system conversions described below. See the page <a href="#/documentation/core-library/coordinate-systems">Coordinate Systems used by the **H3 Core Library**</a> for more information on each of these coordinate systems.
5
+ The conversion is performed as a series of coordinate system conversions described below. See the page [Coordinate Systems used by the **H3 Core Library**](/docs/core-library/coordsystems) for more information on each of these coordinate systems.
7
6
 
8
7
  1. The input latitude/longitude coordinate is first converted into the containing icosahedron face and a *Hex2d* coordinate on that face using function `_geoToHex2d`, which determines the correct face and then performs a face-centered gnomonic projection into face-centered polar coordinates. These polar coordinates are then scaled appropriately to a *Hex2d* coordinate on the input grid resolution *r*.
9
8
  2. The *Hex2d* coordinate is converted into resolution *r* normalized *ijk* coordinates using function `_hex2dToCoordIJK`.
@@ -1,15 +1,14 @@
1
- Generate the cell boundary in latitude/longitude coordinates of an H3Index cell
2
- ---
1
+ # Generate the cell boundary in latitude/longitude coordinates of an H3Index cell
3
2
 
4
3
  This operation is performed by function `h3ToGeoBoundary`. See the comments in the function source code for more detail.
5
4
 
6
- The conversion is performed as a series of coordinate system conversions described below. See the page <a href="#/documentation/core-library/coordinate-systems">Coordinate Systems used by the **H3 Core Library**</a> for more information on each of these coordinate systems.
5
+ The conversion is performed as a series of coordinate system conversions described below. See the page [Coordinate Systems used by the **H3 Core Library**](/docs/core-library/coordsystems) for more information on each of these coordinate systems.
7
6
 
8
7
  * We note that the cell vertices are the center points of cells in an aperture 3 grid one resolution finer than the cell resolution, which we term a *substrate* grid. We precalculate the substrate *ijk* coordinates of a cell with *ijk* coordinates (0,0,0), adding additional aperture 3 and aperture 7 (if required, by Class III cell grid) substrate grid resolutions as required to transform the vertex coordinates into a Class II substrate grid.
9
8
 
10
9
  <div align="center">
11
- <img height="300" src="images/substrate3.png" />
10
+ <img height="300" src="/images/substrate3.png" />
12
11
  </div>
13
12
 
14
- * The function `_faceIjkToGeoBoundary` calculates the *ijk* coordinates of the cell center point in the appropriate substrate grid (determined in the last step), and each of the substrate vertices is translated using the cell center point *ijk*. Each vertex *ijk* is then transformed onto the appropriate face and *Hex2d* coordinate system using the approach taken in <a href="#/documentation/core-library/walkthrough-of-h3togeo">finding a cell center point</a>. If adjacent vertices lie on different icosahedron faces a point is introduced at the intersection of the cell edge and icosahedron face edge.
13
+ * The function `_faceIjkToGeoBoundary` calculates the *ijk* coordinates of the cell center point in the appropriate substrate grid (determined in the last step), and each of the substrate vertices is translated using the cell center point *ijk*. Each vertex *ijk* is then transformed onto the appropriate face and *Hex2d* coordinate system using the approach taken in [finding a cell center point](/docs/core-library/h3ToGeoDesc). If adjacent vertices lie on different icosahedron faces a point is introduced at the intersection of the cell edge and icosahedron face edge.
15
14
  * The *Hex2d* coordinates are then converted to latitude/longitude using `_hex2dToGeo`.