h3 3.6.0 → 3.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby_ci.yml +30 -0
  3. data/.rubocop.yml +1 -1
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +39 -0
  6. data/Gemfile.lock +6 -24
  7. data/LICENSE.md +1 -1
  8. data/README.md +2 -3
  9. data/ext/h3/src/.github/workflows/test-linux.yml +118 -0
  10. data/ext/h3/src/.github/workflows/test-macos.yml +42 -0
  11. data/ext/h3/src/.github/workflows/test-website.yml +32 -0
  12. data/ext/h3/src/.github/workflows/test-windows.yml +44 -0
  13. data/ext/h3/src/.gitignore +5 -0
  14. data/ext/h3/src/.travis.yml +20 -42
  15. data/ext/h3/src/CHANGELOG.md +57 -0
  16. data/ext/h3/src/CMakeLists.txt +135 -33
  17. data/ext/h3/src/CONTRIBUTING.md +1 -1
  18. data/ext/h3/src/README.md +61 -11
  19. data/ext/h3/src/RELEASE.md +3 -1
  20. data/ext/h3/src/VERSION +1 -1
  21. data/ext/h3/src/dev-docs/RFCs/rfc-template.md +21 -0
  22. data/ext/h3/src/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +21 -0
  23. data/ext/h3/src/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md +276 -0
  24. data/ext/h3/src/dev-docs/RFCs/v4.0.0/overrideable-allocators-rfc.md +141 -0
  25. data/ext/h3/src/dev-docs/RFCs/v4.0.0/polyfill-modes-rfc.md +21 -0
  26. data/ext/h3/src/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md +50 -0
  27. data/ext/h3/src/dev-docs/build_windows.md +6 -1
  28. data/ext/h3/src/dev-docs/creating_bindings.md +3 -3
  29. data/ext/h3/src/dev-docs/custom_alloc.md +27 -0
  30. data/ext/h3/src/docs/{overview/mainpage.md → README.md} +2 -3
  31. data/ext/h3/src/docs/api/misc.md +76 -0
  32. data/ext/h3/src/docs/community/applications.md +1 -0
  33. data/ext/h3/src/docs/community/bindings.md +10 -0
  34. data/ext/h3/src/docs/community/tutorials.md +8 -3
  35. data/ext/h3/src/docs/core-library/coordsystems.md +5 -4
  36. data/ext/h3/src/docs/core-library/filters.md +8 -9
  37. data/ext/h3/src/docs/core-library/geoToH3desc.md +2 -3
  38. data/ext/h3/src/docs/core-library/h3ToGeoBoundaryDesc.md +4 -5
  39. data/ext/h3/src/docs/core-library/h3ToGeoDesc.md +3 -4
  40. data/ext/h3/src/docs/core-library/h3indexing.md +26 -17
  41. data/ext/h3/src/docs/core-library/overview.md +2 -3
  42. data/ext/h3/src/docs/core-library/restable.md +1 -2
  43. data/ext/h3/src/docs/core-library/usage.md +1 -2
  44. data/ext/h3/src/docs/table-of-contents.json +47 -0
  45. data/ext/h3/src/docs/{overview/usecases.md → usecases.md} +6 -11
  46. data/ext/h3/src/scripts/binding_functions.sh +1 -1
  47. data/ext/h3/src/scripts/coverage.sh.in +1 -1
  48. data/ext/h3/src/scripts/update_version.sh +2 -2
  49. data/ext/h3/src/src/apps/applib/include/args.h +1 -0
  50. data/ext/h3/src/src/apps/applib/include/test.h +1 -0
  51. data/ext/h3/src/src/apps/applib/include/utility.h +7 -1
  52. data/ext/h3/src/src/apps/applib/lib/args.c +2 -0
  53. data/ext/h3/src/src/apps/applib/lib/kml.c +2 -0
  54. data/ext/h3/src/src/apps/applib/lib/test.c +1 -0
  55. data/ext/h3/src/src/apps/applib/lib/utility.c +133 -2
  56. data/ext/h3/src/src/apps/benchmarks/benchmarkH3Api.c +1 -1
  57. data/ext/h3/src/{website/html.config.js → src/apps/benchmarks/benchmarkH3UniEdge.c} +15 -12
  58. data/ext/h3/src/src/apps/filters/h3ToComponents.c +1 -0
  59. data/ext/h3/src/src/apps/filters/h3ToGeo.c +1 -0
  60. data/ext/h3/src/src/apps/filters/h3ToGeoBoundary.c +1 -0
  61. data/ext/h3/src/src/apps/filters/h3ToLocalIj.c +1 -0
  62. data/ext/h3/src/src/apps/filters/hexRange.c +1 -0
  63. data/ext/h3/src/src/apps/filters/kRing.c +1 -0
  64. data/ext/h3/src/src/apps/filters/localIjToH3.c +1 -0
  65. data/ext/h3/src/src/apps/miscapps/generateFaceCenterPoint.c +1 -0
  66. data/ext/h3/src/src/apps/miscapps/generateNumHexagons.c +1 -0
  67. data/ext/h3/src/src/apps/miscapps/generatePentagonDirectionFaces.c +67 -0
  68. data/ext/h3/src/src/apps/miscapps/h3ToGeoBoundaryHier.c +1 -0
  69. data/ext/h3/src/src/apps/miscapps/h3ToGeoHier.c +1 -0
  70. data/ext/h3/src/src/apps/miscapps/h3ToHier.c +1 -0
  71. data/ext/h3/src/src/apps/testapps/mkRandGeo.c +1 -0
  72. data/ext/h3/src/src/apps/testapps/mkRandGeoBoundary.c +1 -0
  73. data/ext/h3/src/src/apps/testapps/testBBox.c +1 -0
  74. data/ext/h3/src/src/apps/testapps/testBaseCells.c +15 -1
  75. data/ext/h3/src/src/apps/testapps/testCompact.c +109 -2
  76. data/ext/h3/src/src/apps/testapps/testCoordIj.c +1 -0
  77. data/ext/h3/src/src/apps/testapps/testGeoCoord.c +47 -8
  78. data/ext/h3/src/src/apps/testapps/testGeoToH3.c +1 -0
  79. data/ext/h3/src/src/apps/testapps/testH3Api.c +1 -0
  80. data/ext/h3/src/src/apps/testapps/testH3CellArea.c +47 -0
  81. data/ext/h3/src/src/apps/testapps/testH3CellAreaExhaustive.c +180 -0
  82. data/ext/h3/src/src/apps/testapps/testH3Distance.c +1 -0
  83. data/ext/h3/src/src/apps/testapps/testH3DistanceExhaustive.c +1 -0
  84. data/ext/h3/src/src/apps/testapps/testH3GetFaces.c +1 -0
  85. data/ext/h3/src/src/apps/testapps/testH3Index.c +33 -3
  86. data/ext/h3/src/src/apps/testapps/testH3Line.c +1 -0
  87. data/ext/h3/src/src/apps/testapps/testH3LineExhaustive.c +1 -0
  88. data/ext/h3/src/src/apps/testapps/testH3Memory.c +175 -0
  89. data/ext/h3/src/src/apps/testapps/testH3NeighborRotations.c +1 -0
  90. data/ext/h3/src/src/apps/testapps/testH3SetToLinkedGeo.c +1 -0
  91. data/ext/h3/src/src/apps/testapps/testH3SetToVertexGraph.c +1 -0
  92. data/ext/h3/src/src/apps/testapps/testH3ToCenterChild.c +1 -0
  93. data/ext/h3/src/src/apps/testapps/testH3ToChildren.c +1 -0
  94. data/ext/h3/src/src/apps/testapps/testH3ToGeo.c +1 -0
  95. data/ext/h3/src/src/apps/testapps/testH3ToGeoBoundary.c +1 -0
  96. data/ext/h3/src/src/apps/testapps/testH3ToLocalIj.c +12 -6
  97. data/ext/h3/src/src/apps/testapps/testH3ToLocalIjExhaustive.c +1 -0
  98. data/ext/h3/src/src/apps/testapps/testH3ToParent.c +1 -0
  99. data/ext/h3/src/src/apps/testapps/testH3UniEdge.c +45 -16
  100. data/ext/h3/src/src/apps/testapps/testH3UniEdgeExhaustive.c +111 -0
  101. data/ext/h3/src/src/apps/testapps/testHexRanges.c +1 -0
  102. data/ext/h3/src/src/apps/testapps/testHexRing.c +1 -0
  103. data/ext/h3/src/src/apps/testapps/testKRing.c +19 -0
  104. data/ext/h3/src/src/apps/testapps/testLinkedGeo.c +1 -0
  105. data/ext/h3/src/src/apps/testapps/testMaxH3ToChildrenSize.c +1 -0
  106. data/ext/h3/src/src/apps/testapps/testPentagonIndexes.c +1 -0
  107. data/ext/h3/src/src/apps/testapps/testPolyfill.c +72 -9
  108. data/ext/h3/src/src/apps/testapps/testPolyfillReported.c +157 -0
  109. data/ext/h3/src/src/apps/testapps/testPolygon.c +27 -1
  110. data/ext/h3/src/src/apps/testapps/testVec2d.c +1 -0
  111. data/ext/h3/src/src/apps/testapps/testVec3d.c +1 -0
  112. data/ext/h3/src/src/apps/testapps/testVertex.c +66 -0
  113. data/ext/h3/src/src/apps/testapps/testVertexGraph.c +1 -0
  114. data/ext/h3/src/src/h3lib/include/algos.h +8 -0
  115. data/ext/h3/src/src/h3lib/include/alloc.h +40 -0
  116. data/ext/h3/src/src/h3lib/include/baseCells.h +4 -0
  117. data/ext/h3/src/src/h3lib/include/bbox.h +4 -1
  118. data/ext/h3/src/src/h3lib/include/faceijk.h +3 -2
  119. data/ext/h3/src/src/h3lib/include/geoCoord.h +2 -3
  120. data/ext/h3/src/src/h3lib/include/h3Index.h +37 -4
  121. data/ext/h3/src/src/h3lib/include/h3api.h.in +65 -17
  122. data/ext/h3/src/src/h3lib/include/linkedGeo.h +1 -0
  123. data/ext/h3/src/src/h3lib/include/polygon.h +1 -0
  124. data/ext/h3/src/src/h3lib/include/polygonAlgos.h +1 -0
  125. data/ext/h3/src/src/h3lib/include/vertex.h +44 -0
  126. data/ext/h3/src/src/h3lib/include/vertexGraph.h +1 -0
  127. data/ext/h3/src/src/h3lib/lib/algos.c +304 -76
  128. data/ext/h3/src/src/h3lib/lib/baseCells.c +26 -4
  129. data/ext/h3/src/src/h3lib/lib/bbox.c +56 -27
  130. data/ext/h3/src/src/h3lib/lib/coordijk.c +2 -0
  131. data/ext/h3/src/src/h3lib/lib/faceijk.c +32 -21
  132. data/ext/h3/src/src/h3lib/lib/geoCoord.c +162 -44
  133. data/ext/h3/src/src/h3lib/lib/h3Index.c +83 -42
  134. data/ext/h3/src/src/h3lib/lib/h3UniEdge.c +42 -57
  135. data/ext/h3/src/src/h3lib/lib/linkedGeo.c +20 -15
  136. data/ext/h3/src/src/h3lib/lib/localij.c +1 -1
  137. data/ext/h3/src/src/h3lib/lib/polygon.c +2 -0
  138. data/ext/h3/src/src/h3lib/lib/vec2d.c +1 -0
  139. data/ext/h3/src/src/h3lib/lib/vec3d.c +1 -0
  140. data/ext/h3/src/src/h3lib/lib/vertex.c +134 -0
  141. data/ext/h3/src/src/h3lib/lib/vertexGraph.c +8 -5
  142. data/ext/h3/src/website/.eslintignore +2 -0
  143. data/ext/h3/src/website/.gitignore +57 -0
  144. data/ext/h3/src/website/.nvmrc +1 -0
  145. data/ext/h3/src/website/README.md +8 -6
  146. data/ext/h3/src/website/gatsby-config.js +83 -0
  147. data/ext/h3/src/website/package.json +20 -12
  148. data/ext/h3/src/website/scripts/build-to-gh-pages.sh +7 -5
  149. data/ext/h3/src/website/src/.gitkeep +0 -0
  150. data/ext/h3/src/website/templates/documentation.jsx +129 -0
  151. data/ext/h3/src/website/yarn.lock +13723 -0
  152. data/h3.gemspec +2 -2
  153. data/lib/h3/bindings/base.rb +14 -4
  154. data/lib/h3/bindings/private.rb +12 -9
  155. data/lib/h3/hierarchy.rb +0 -18
  156. data/lib/h3/indexing.rb +0 -18
  157. data/lib/h3/inspection.rb +3 -59
  158. data/lib/h3/miscellaneous.rb +119 -14
  159. data/lib/h3/regions.rb +3 -0
  160. data/lib/h3/traversal.rb +0 -18
  161. data/lib/h3/unidirectional_edges.rb +5 -60
  162. data/lib/h3/version.rb +1 -1
  163. data/spec/geo_json_spec.rb +8 -0
  164. data/spec/miscellaneous_spec.rb +117 -0
  165. data/spec/{region_spec.rb → regions_spec.rb} +1 -1
  166. data/spec/spec_helper.rb +2 -2
  167. metadata +44 -36
  168. data/.travis.yml +0 -11
  169. data/ext/h3/src/.ycm_extra_conf.py +0 -92
  170. data/ext/h3/src/appveyor.yml +0 -50
  171. data/ext/h3/src/website/src/config.js +0 -46
  172. data/ext/h3/src/website/src/mdRoutes.js +0 -151
  173. data/ext/h3/src/website/src/styles/_variables.scss +0 -16
  174. data/ext/h3/src/website/src/styles/index.scss +0 -3
  175. data/ext/h3/src/website/static/index.html +0 -15
@@ -0,0 +1,141 @@
1
+ # RFC: Overrideable allocation functions for H3
2
+
3
+ * **Authors**: Isaac Brodsky (@isaacbrodsky)
4
+ * **Date**: February 7, 2020
5
+ * **Status**: Draft
6
+
7
+ ## Overview
8
+
9
+ This is a proposal for adding a mechanism for users of the H3 library to provide heap allocator instead of the default
10
+ malloc implementation.
11
+
12
+ ## Motivation
13
+
14
+ This will address the following use cases:
15
+
16
+ * H3 is used inside of another application which has its own heap management scheme. For example, using the allocation
17
+ functions provided by Postgres or the Java Virtual Machine.
18
+ * Testing of failure cases of H3, by simulating allocation failures.
19
+
20
+ Most H3 functions accept memory from the caller in order to avoid this problem. This will still be the preferred way
21
+ to handle memory management in H3. Stack allocation is avoided because H3 cannot know whether there is sufficient stack
22
+ memory available. (Note that `_kRingInternal`/`kRingDistances` implicitly uses stack allocation because it implements DFS
23
+ recursively.)
24
+
25
+ A few functions in H3 do heap allocate memory because it is not feasible to do otherwise, or as a convenience. The
26
+ functions that heap allocate are:
27
+
28
+ | Function | Reason
29
+ | --- | ---
30
+ | `kRing`| Convenience wrapper around `kRingDistances`
31
+ | `polyfill` | Convenience (could be passed in, requires internal knowledge)
32
+ | `compact` | Convenience (could be passed in, requires internal knowledge)
33
+ | `h3SetToLinkedGeo` | Requires knowledge of how to initialize the internal struct
34
+ | `destroyLinkedPolygon` | Required for `h3SetToLinkedGeo`
35
+
36
+ ## Prior Art
37
+
38
+ Reading materials to reference:
39
+
40
+ * [C++ `vector`](http://www.cplusplus.com/reference/vector/vector/) (via templates)
41
+ * [SDL](https://discourse.libsdl.org/t/sdl-2-0-7-prerelease/23232) (via `SDL_SetMemoryFunctions`)
42
+ * [PostgreSQL](https://www.postgresql.org/docs/10/xfunc-c.html) (via `palloc`)
43
+ * [SQLite](https://sqlite.org/malloc.html)
44
+
45
+ ## Approaches
46
+
47
+ All approaches assume the user has defined the following functions:
48
+
49
+ ```
50
+ void* my_malloc(size_t size);
51
+ void* my_calloc(size_t count, size_t size);
52
+ void my_free(void* pointer);
53
+
54
+ // TODO: Do we want my_realloc?
55
+ ```
56
+
57
+ ### Global statics
58
+
59
+ In this approach, H3 stores the allocation functions in a set of static variables.
60
+
61
+ ```
62
+ h3SetAllocator(&my_alloc, &my_calloc, &my_free);
63
+
64
+ // call into H3 as before
65
+ polyfill(geoPolygon, res, out);
66
+ ```
67
+
68
+ Pro:
69
+ * Allows the user to replace allocators at run time.
70
+
71
+ Con:
72
+ * Not thread safe, or an additional, complicated dependency is needed to ensure thread safety.
73
+ * Global state.
74
+
75
+ ### Templates
76
+
77
+ This approach is similar to how C++ handles allocator replacement in its standard library, by accepting the allocator
78
+ as a template argument. However, H3 is written in C and must implement templates using macros.
79
+
80
+ ```
81
+ POLYFILL_WITH_ALLLOCATORS(my_polyfill, my_malloc, my_calloc, my_free);
82
+
83
+ // Call the function created by the template
84
+ my_polyfill(geoPolygon, res, out);
85
+ ```
86
+
87
+ Pro:
88
+ * Allows the user to have multiple allocator replacements in use at once.
89
+
90
+ Con:
91
+ * Exposes a complicated build process to the user in the form of macros.
92
+
93
+ ### Allocator argument approach
94
+
95
+ In this approach, every function call includes allocators.
96
+
97
+ ```
98
+ H3MemoryManager allocFunctions = {
99
+ .malloc = &my_malloc,
100
+ .calloc = &my_calloc,
101
+ .free = &my_free
102
+ };
103
+
104
+ polyfill(geoPolygon, res, out, &allocFunctions);
105
+ ```
106
+
107
+ Pro:
108
+ * Allowing replacement on a per-call basis allows for maximum control by the user.
109
+
110
+ Con:
111
+ * The user must always specify allocators, which is unlikely to be needed by most users.
112
+ * Alternately, additional overloads of all H3 functions that heap-allocate are needed.
113
+
114
+ ### `#define` approach
115
+
116
+ In this approach, the allocators are specified at build time.
117
+
118
+ ```
119
+ # In build process:
120
+ cmake -DH3_ALLOC_PREFIX=my_ ...
121
+
122
+ // in source file, functions are used as before.
123
+ ```
124
+
125
+ Alternately, instead of setting a prefix, the build could accept individual options
126
+ for functions, such as `-DH3_MALLOC=my_malloc -DH3_CALLOC=my_calloc`. (Although this
127
+ could allow a user to accidentally override `malloc` but not `free`, which is generally
128
+ very bad.)
129
+
130
+ Pro:
131
+ * Minimal overhead for users and developers when allocator replacement is not needed.
132
+
133
+ Con:
134
+ * Complex allocator replacement (i.e. different allocators for different calls) is possible but requires implementation
135
+ by the user.
136
+
137
+ ## Proposal
138
+
139
+ `#define` based allocator replacement seems like the clearest and lowest overhead to implement, while still supporting
140
+ the full range of use cases. A user could optionally implement a more complicated replacement inside their custom
141
+ allocator functions.
@@ -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.
@@ -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
  ```
@@ -91,3 +140,30 @@ int pentagonIndexCount();
91
140
  ```
92
141
 
93
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)