h3 3.6.0 → 3.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby_ci.yml +30 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +39 -0
- data/Gemfile.lock +6 -24
- data/LICENSE.md +1 -1
- data/README.md +2 -3
- data/ext/h3/src/.github/workflows/test-linux.yml +118 -0
- data/ext/h3/src/.github/workflows/test-macos.yml +42 -0
- data/ext/h3/src/.github/workflows/test-website.yml +32 -0
- data/ext/h3/src/.github/workflows/test-windows.yml +44 -0
- data/ext/h3/src/.gitignore +5 -0
- data/ext/h3/src/.travis.yml +20 -42
- data/ext/h3/src/CHANGELOG.md +57 -0
- data/ext/h3/src/CMakeLists.txt +135 -33
- data/ext/h3/src/CONTRIBUTING.md +1 -1
- data/ext/h3/src/README.md +61 -11
- data/ext/h3/src/RELEASE.md +3 -1
- data/ext/h3/src/VERSION +1 -1
- data/ext/h3/src/dev-docs/RFCs/rfc-template.md +21 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +21 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md +276 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/overrideable-allocators-rfc.md +141 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/polyfill-modes-rfc.md +21 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md +50 -0
- data/ext/h3/src/dev-docs/build_windows.md +6 -1
- data/ext/h3/src/dev-docs/creating_bindings.md +3 -3
- data/ext/h3/src/dev-docs/custom_alloc.md +27 -0
- data/ext/h3/src/docs/{overview/mainpage.md → README.md} +2 -3
- data/ext/h3/src/docs/api/misc.md +76 -0
- data/ext/h3/src/docs/community/applications.md +1 -0
- data/ext/h3/src/docs/community/bindings.md +10 -0
- data/ext/h3/src/docs/community/tutorials.md +8 -3
- data/ext/h3/src/docs/core-library/coordsystems.md +5 -4
- data/ext/h3/src/docs/core-library/filters.md +8 -9
- data/ext/h3/src/docs/core-library/geoToH3desc.md +2 -3
- data/ext/h3/src/docs/core-library/h3ToGeoBoundaryDesc.md +4 -5
- data/ext/h3/src/docs/core-library/h3ToGeoDesc.md +3 -4
- data/ext/h3/src/docs/core-library/h3indexing.md +26 -17
- data/ext/h3/src/docs/core-library/overview.md +2 -3
- data/ext/h3/src/docs/core-library/restable.md +1 -2
- data/ext/h3/src/docs/core-library/usage.md +1 -2
- data/ext/h3/src/docs/table-of-contents.json +47 -0
- data/ext/h3/src/docs/{overview/usecases.md → usecases.md} +6 -11
- data/ext/h3/src/scripts/binding_functions.sh +1 -1
- data/ext/h3/src/scripts/coverage.sh.in +1 -1
- data/ext/h3/src/scripts/update_version.sh +2 -2
- data/ext/h3/src/src/apps/applib/include/args.h +1 -0
- data/ext/h3/src/src/apps/applib/include/test.h +1 -0
- data/ext/h3/src/src/apps/applib/include/utility.h +7 -1
- data/ext/h3/src/src/apps/applib/lib/args.c +2 -0
- data/ext/h3/src/src/apps/applib/lib/kml.c +2 -0
- data/ext/h3/src/src/apps/applib/lib/test.c +1 -0
- data/ext/h3/src/src/apps/applib/lib/utility.c +133 -2
- data/ext/h3/src/src/apps/benchmarks/benchmarkH3Api.c +1 -1
- data/ext/h3/src/{website/html.config.js → src/apps/benchmarks/benchmarkH3UniEdge.c} +15 -12
- data/ext/h3/src/src/apps/filters/h3ToComponents.c +1 -0
- data/ext/h3/src/src/apps/filters/h3ToGeo.c +1 -0
- data/ext/h3/src/src/apps/filters/h3ToGeoBoundary.c +1 -0
- data/ext/h3/src/src/apps/filters/h3ToLocalIj.c +1 -0
- data/ext/h3/src/src/apps/filters/hexRange.c +1 -0
- data/ext/h3/src/src/apps/filters/kRing.c +1 -0
- data/ext/h3/src/src/apps/filters/localIjToH3.c +1 -0
- data/ext/h3/src/src/apps/miscapps/generateFaceCenterPoint.c +1 -0
- data/ext/h3/src/src/apps/miscapps/generateNumHexagons.c +1 -0
- data/ext/h3/src/src/apps/miscapps/generatePentagonDirectionFaces.c +67 -0
- data/ext/h3/src/src/apps/miscapps/h3ToGeoBoundaryHier.c +1 -0
- data/ext/h3/src/src/apps/miscapps/h3ToGeoHier.c +1 -0
- data/ext/h3/src/src/apps/miscapps/h3ToHier.c +1 -0
- data/ext/h3/src/src/apps/testapps/mkRandGeo.c +1 -0
- data/ext/h3/src/src/apps/testapps/mkRandGeoBoundary.c +1 -0
- data/ext/h3/src/src/apps/testapps/testBBox.c +1 -0
- data/ext/h3/src/src/apps/testapps/testBaseCells.c +15 -1
- data/ext/h3/src/src/apps/testapps/testCompact.c +109 -2
- data/ext/h3/src/src/apps/testapps/testCoordIj.c +1 -0
- data/ext/h3/src/src/apps/testapps/testGeoCoord.c +47 -8
- data/ext/h3/src/src/apps/testapps/testGeoToH3.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3Api.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3CellArea.c +47 -0
- data/ext/h3/src/src/apps/testapps/testH3CellAreaExhaustive.c +180 -0
- data/ext/h3/src/src/apps/testapps/testH3Distance.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3DistanceExhaustive.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3GetFaces.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3Index.c +33 -3
- data/ext/h3/src/src/apps/testapps/testH3Line.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3LineExhaustive.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3Memory.c +175 -0
- data/ext/h3/src/src/apps/testapps/testH3NeighborRotations.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3SetToLinkedGeo.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3SetToVertexGraph.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToCenterChild.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToChildren.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToGeo.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToGeoBoundary.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToLocalIj.c +12 -6
- data/ext/h3/src/src/apps/testapps/testH3ToLocalIjExhaustive.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToParent.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3UniEdge.c +45 -16
- data/ext/h3/src/src/apps/testapps/testH3UniEdgeExhaustive.c +111 -0
- data/ext/h3/src/src/apps/testapps/testHexRanges.c +1 -0
- data/ext/h3/src/src/apps/testapps/testHexRing.c +1 -0
- data/ext/h3/src/src/apps/testapps/testKRing.c +19 -0
- data/ext/h3/src/src/apps/testapps/testLinkedGeo.c +1 -0
- data/ext/h3/src/src/apps/testapps/testMaxH3ToChildrenSize.c +1 -0
- data/ext/h3/src/src/apps/testapps/testPentagonIndexes.c +1 -0
- data/ext/h3/src/src/apps/testapps/testPolyfill.c +72 -9
- data/ext/h3/src/src/apps/testapps/testPolyfillReported.c +157 -0
- data/ext/h3/src/src/apps/testapps/testPolygon.c +27 -1
- data/ext/h3/src/src/apps/testapps/testVec2d.c +1 -0
- data/ext/h3/src/src/apps/testapps/testVec3d.c +1 -0
- data/ext/h3/src/src/apps/testapps/testVertex.c +66 -0
- data/ext/h3/src/src/apps/testapps/testVertexGraph.c +1 -0
- data/ext/h3/src/src/h3lib/include/algos.h +8 -0
- data/ext/h3/src/src/h3lib/include/alloc.h +40 -0
- data/ext/h3/src/src/h3lib/include/baseCells.h +4 -0
- data/ext/h3/src/src/h3lib/include/bbox.h +4 -1
- data/ext/h3/src/src/h3lib/include/faceijk.h +3 -2
- data/ext/h3/src/src/h3lib/include/geoCoord.h +2 -3
- data/ext/h3/src/src/h3lib/include/h3Index.h +37 -4
- data/ext/h3/src/src/h3lib/include/h3api.h.in +65 -17
- data/ext/h3/src/src/h3lib/include/linkedGeo.h +1 -0
- data/ext/h3/src/src/h3lib/include/polygon.h +1 -0
- data/ext/h3/src/src/h3lib/include/polygonAlgos.h +1 -0
- data/ext/h3/src/src/h3lib/include/vertex.h +44 -0
- data/ext/h3/src/src/h3lib/include/vertexGraph.h +1 -0
- data/ext/h3/src/src/h3lib/lib/algos.c +304 -76
- data/ext/h3/src/src/h3lib/lib/baseCells.c +26 -4
- data/ext/h3/src/src/h3lib/lib/bbox.c +56 -27
- data/ext/h3/src/src/h3lib/lib/coordijk.c +2 -0
- data/ext/h3/src/src/h3lib/lib/faceijk.c +32 -21
- data/ext/h3/src/src/h3lib/lib/geoCoord.c +162 -44
- data/ext/h3/src/src/h3lib/lib/h3Index.c +83 -42
- data/ext/h3/src/src/h3lib/lib/h3UniEdge.c +42 -57
- data/ext/h3/src/src/h3lib/lib/linkedGeo.c +20 -15
- data/ext/h3/src/src/h3lib/lib/localij.c +1 -1
- data/ext/h3/src/src/h3lib/lib/polygon.c +2 -0
- data/ext/h3/src/src/h3lib/lib/vec2d.c +1 -0
- data/ext/h3/src/src/h3lib/lib/vec3d.c +1 -0
- data/ext/h3/src/src/h3lib/lib/vertex.c +134 -0
- data/ext/h3/src/src/h3lib/lib/vertexGraph.c +8 -5
- data/ext/h3/src/website/.eslintignore +2 -0
- data/ext/h3/src/website/.gitignore +57 -0
- data/ext/h3/src/website/.nvmrc +1 -0
- data/ext/h3/src/website/README.md +8 -6
- data/ext/h3/src/website/gatsby-config.js +83 -0
- data/ext/h3/src/website/package.json +20 -12
- data/ext/h3/src/website/scripts/build-to-gh-pages.sh +7 -5
- data/ext/h3/src/website/src/.gitkeep +0 -0
- data/ext/h3/src/website/templates/documentation.jsx +129 -0
- data/ext/h3/src/website/yarn.lock +13723 -0
- data/h3.gemspec +2 -2
- data/lib/h3/bindings/base.rb +14 -4
- data/lib/h3/bindings/private.rb +12 -9
- data/lib/h3/hierarchy.rb +0 -18
- data/lib/h3/indexing.rb +0 -18
- data/lib/h3/inspection.rb +3 -59
- data/lib/h3/miscellaneous.rb +119 -14
- data/lib/h3/regions.rb +3 -0
- data/lib/h3/traversal.rb +0 -18
- data/lib/h3/unidirectional_edges.rb +5 -60
- data/lib/h3/version.rb +1 -1
- data/spec/geo_json_spec.rb +8 -0
- data/spec/miscellaneous_spec.rb +117 -0
- data/spec/{region_spec.rb → regions_spec.rb} +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +44 -36
- data/.travis.yml +0 -11
- data/ext/h3/src/.ycm_extra_conf.py +0 -92
- data/ext/h3/src/appveyor.yml +0 -50
- data/ext/h3/src/website/src/config.js +0 -46
- data/ext/h3/src/website/src/mdRoutes.js +0 -151
- data/ext/h3/src/website/src/styles/_variables.scss +0 -16
- data/ext/h3/src/website/src/styles/index.scss +0 -3
- data/ext/h3/src/website/static/index.html +0 -15
data/lib/h3/regions.rb
CHANGED
|
@@ -141,6 +141,7 @@ module H3
|
|
|
141
141
|
linked_geo_polygon = LinkedGeoPolygon.new
|
|
142
142
|
Bindings::Private.h3_set_to_linked_geo(h3_set, h3_indexes.size, linked_geo_polygon)
|
|
143
143
|
|
|
144
|
+
# The algorithm in h3 currently only handles 1 polygon
|
|
144
145
|
extract_linked_geo_polygon(linked_geo_polygon).first
|
|
145
146
|
ensure
|
|
146
147
|
Bindings::Private.destroy_linked_polygon(linked_geo_polygon)
|
|
@@ -154,6 +155,8 @@ module H3
|
|
|
154
155
|
geo_polygons = [linked_geo_polygon]
|
|
155
156
|
|
|
156
157
|
until linked_geo_polygon[:next].null?
|
|
158
|
+
# Until the h3 algorithm is updated to handle multiple polygons,
|
|
159
|
+
# this block will never run.
|
|
157
160
|
geo_polygons << linked_geo_polygon[:next]
|
|
158
161
|
linked_geo_polygon = linked_geo_polygon[:next]
|
|
159
162
|
end
|
data/lib/h3/traversal.rb
CHANGED
|
@@ -32,12 +32,6 @@ module H3
|
|
|
32
32
|
# @return [Integer] Distance between indexes.
|
|
33
33
|
attach_function :distance, :h3Distance, %i[h3_index h3_index], :k_distance
|
|
34
34
|
|
|
35
|
-
# @deprecated Please use {#distance} instead.
|
|
36
|
-
def h3_distance(origin, destination)
|
|
37
|
-
distance(origin, destination)
|
|
38
|
-
end
|
|
39
|
-
deprecate :h3_distance, :distance, 2020, 1
|
|
40
|
-
|
|
41
35
|
# @!method line_size(origin, destination)
|
|
42
36
|
#
|
|
43
37
|
# Derive the number of hexagons present in a line between two H3 indexes.
|
|
@@ -57,12 +51,6 @@ module H3
|
|
|
57
51
|
# @return [Integer] Number of hexagons found between indexes.
|
|
58
52
|
attach_function :line_size, :h3LineSize, %i[h3_index h3_index], :int
|
|
59
53
|
|
|
60
|
-
# @deprecated Please use {#line_size} instead.
|
|
61
|
-
def h3_line_size(origin, destination)
|
|
62
|
-
line_size(origin, destination)
|
|
63
|
-
end
|
|
64
|
-
deprecate :h3_line_size, :line_size, 2020, 1
|
|
65
|
-
|
|
66
54
|
# Derives H3 indexes within k distance of the origin H3 index.
|
|
67
55
|
#
|
|
68
56
|
# Similar to {k_ring}, except that an error is raised when one of the indexes
|
|
@@ -317,12 +305,6 @@ module H3
|
|
|
317
305
|
hexagons.read
|
|
318
306
|
end
|
|
319
307
|
|
|
320
|
-
# @deprecated Please use {#line} instead.
|
|
321
|
-
def h3_line(origin, destination)
|
|
322
|
-
line(origin, destination)
|
|
323
|
-
end
|
|
324
|
-
deprecate :h3_line, :line, 2020, 1
|
|
325
|
-
|
|
326
308
|
private
|
|
327
309
|
|
|
328
310
|
def k_rings_for_hex_range(indexes, k)
|
|
@@ -17,16 +17,7 @@ module H3
|
|
|
17
17
|
# true
|
|
18
18
|
#
|
|
19
19
|
# @return [Boolean] True if indexes are neighbors
|
|
20
|
-
|
|
21
|
-
alias_method :neighbors?, :neighbors
|
|
22
|
-
undef_method :neighbors
|
|
23
|
-
|
|
24
|
-
# @deprecated Please use {#neighbors?} instead.
|
|
25
|
-
def h3_indexes_neighbors?(origin, destination)
|
|
26
|
-
neighbors?(origin, destination)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
deprecate :h3_indexes_neighbors?, :neighbors?, 2020, 1
|
|
20
|
+
attach_predicate_function :neighbors?, :h3IndexesAreNeighbors, %i[h3_index h3_index], :bool
|
|
30
21
|
|
|
31
22
|
# @!method unidirectional_edge_valid?(h3_index)
|
|
32
23
|
#
|
|
@@ -39,19 +30,10 @@ module H3
|
|
|
39
30
|
# true
|
|
40
31
|
#
|
|
41
32
|
# @return [Boolean] True if H3 index is a valid unidirectional edge
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
alias_method :unidirectional_edge_valid?, :unidirectional_edge_valid
|
|
47
|
-
undef_method :unidirectional_edge_valid
|
|
48
|
-
|
|
49
|
-
# @deprecated Please use {#unidirectional_edge_valid?} instead.
|
|
50
|
-
def h3_unidirectional_edge_valid?(h3_index)
|
|
51
|
-
unidirectional_edge_valid?(h3_index)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
deprecate :h3_unidirectional_edge_valid?, :unidirectional_edge_valid?, 2020, 1
|
|
33
|
+
attach_predicate_function :unidirectional_edge_valid?,
|
|
34
|
+
:h3UnidirectionalEdgeIsValid,
|
|
35
|
+
%i[h3_index],
|
|
36
|
+
:bool
|
|
55
37
|
|
|
56
38
|
# @!method unidirectional_edge(origin, destination)
|
|
57
39
|
#
|
|
@@ -70,13 +52,6 @@ module H3
|
|
|
70
52
|
%i[h3_index h3_index],
|
|
71
53
|
:h3_index
|
|
72
54
|
|
|
73
|
-
# @deprecated Please use {#unidirectional_edge} instead.
|
|
74
|
-
def h3_unidirectional_edge(origin, destination)
|
|
75
|
-
unidirectional_edge(origin, destination)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
deprecate :h3_unidirectional_edge, :unidirectional_edge, 2020, 1
|
|
79
|
-
|
|
80
55
|
# @!method destination_from_unidirectional_edge(edge)
|
|
81
56
|
#
|
|
82
57
|
# Derive destination H3 index from edge.
|
|
@@ -129,16 +104,6 @@ module H3
|
|
|
129
104
|
out.read
|
|
130
105
|
end
|
|
131
106
|
|
|
132
|
-
# @deprecated Please use {#origin_and_destination_from_unidirectional_edge} instead.
|
|
133
|
-
def h3_indexes_from_unidirectional_edge(edge)
|
|
134
|
-
origin_and_destination_from_unidirectional_edge(edge)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
deprecate :h3_indexes_from_unidirectional_edge,
|
|
138
|
-
:origin_and_destination_from_unidirectional_edge,
|
|
139
|
-
2020,
|
|
140
|
-
1
|
|
141
|
-
|
|
142
107
|
# Derive unidirectional edges for a H3 index.
|
|
143
108
|
#
|
|
144
109
|
# @param [Integer] origin H3 index
|
|
@@ -158,16 +123,6 @@ module H3
|
|
|
158
123
|
out.read
|
|
159
124
|
end
|
|
160
125
|
|
|
161
|
-
# @deprecated Please use {#unidirectional_edges_from_hexagon} instead.
|
|
162
|
-
def h3_unidirectional_edges_from_hexagon(origin)
|
|
163
|
-
unidirectional_edges_from_hexagon(origin)
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
deprecate :h3_unidirectional_edges_from_hexagon,
|
|
167
|
-
:unidirectional_edges_from_hexagon,
|
|
168
|
-
2020,
|
|
169
|
-
1
|
|
170
|
-
|
|
171
126
|
# Derive coordinates for edge boundary.
|
|
172
127
|
#
|
|
173
128
|
# @param [Integer] edge H3 edge index
|
|
@@ -188,15 +143,5 @@ module H3
|
|
|
188
143
|
[rads_to_degs(d[:lat]), rads_to_degs(d[:lon])]
|
|
189
144
|
end
|
|
190
145
|
end
|
|
191
|
-
|
|
192
|
-
# @deprecated Please use {#unidirectional_edge_boundary} instead.
|
|
193
|
-
def h3_unidirectional_edge_boundary(edge)
|
|
194
|
-
unidirectional_edge_boundary(edge)
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
deprecate :h3_unidirectional_edge_boundary,
|
|
198
|
-
:unidirectional_edge_boundary,
|
|
199
|
-
2020,
|
|
200
|
-
1
|
|
201
146
|
end
|
|
202
147
|
end
|
data/lib/h3/version.rb
CHANGED
data/spec/geo_json_spec.rb
CHANGED
|
@@ -60,6 +60,14 @@ RSpec.describe H3 do
|
|
|
60
60
|
expect { geo_json_to_coordinates }.to raise_error(ArgumentError)
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
|
+
|
|
64
|
+
context "when given JSON with the wrong structure" do
|
|
65
|
+
let(:input) { { blah: "blah" }.to_json }
|
|
66
|
+
|
|
67
|
+
it "raises an error" do
|
|
68
|
+
expect { geo_json_to_coordinates }.to raise_error(ArgumentError)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
63
71
|
end
|
|
64
72
|
|
|
65
73
|
describe ".coordinates_to_geo_json" do
|
data/spec/miscellaneous_spec.rb
CHANGED
|
@@ -109,4 +109,121 @@ RSpec.describe H3 do
|
|
|
109
109
|
expect(pentagons).to eq(expected)
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
|
+
|
|
113
|
+
describe ".cell_area_rads2" do
|
|
114
|
+
let(:cell) { "8928308280fffff".to_i(16) }
|
|
115
|
+
let(:expected) { 2.6952182709835757e-09 }
|
|
116
|
+
subject(:cell_area_rads2) { H3.cell_area_rads2(cell) }
|
|
117
|
+
|
|
118
|
+
it "returns cell area in rads2" do
|
|
119
|
+
expect(cell_area_rads2).to be_within(0.0001).of(expected)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
describe ".cell_area_km2" do
|
|
124
|
+
let(:cell) { "8928308280fffff".to_i(16) }
|
|
125
|
+
let(:expected) { 0.10939818864648902 }
|
|
126
|
+
subject(:cell_area_km2) { H3.cell_area_km2(cell) }
|
|
127
|
+
|
|
128
|
+
it "returns cell area in km2" do
|
|
129
|
+
expect(cell_area_km2).to be_within(0.0001).of(expected)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
describe ".cell_area_m2" do
|
|
134
|
+
let(:cell) { "8928308280fffff".to_i(16) }
|
|
135
|
+
let(:expected) { 109398.18864648901 }
|
|
136
|
+
subject(:cell_area_m2) { H3.cell_area_m2(cell) }
|
|
137
|
+
|
|
138
|
+
it "returns cell area in m2" do
|
|
139
|
+
expect(cell_area_m2).to be_within(0.0001).of(expected)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
describe ".exact_edge_length_rads" do
|
|
144
|
+
let(:cell) { "11928308280fffff".to_i(16) }
|
|
145
|
+
let(:expected) { 3.287684056071637e-05 }
|
|
146
|
+
subject(:exact_edge_length_rads) { H3.exact_edge_length_rads(cell) }
|
|
147
|
+
|
|
148
|
+
it "returns edge length in rads" do
|
|
149
|
+
expect(exact_edge_length_rads).to be_within(0.0001).of(expected)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
describe ".exact_edge_length_km" do
|
|
154
|
+
let(:cell) { "11928308280fffff".to_i(16) }
|
|
155
|
+
let(:expected) { 0.20945858729823577 }
|
|
156
|
+
subject(:exact_edge_length_km) { H3.exact_edge_length_km(cell) }
|
|
157
|
+
|
|
158
|
+
it "returns edge length in km" do
|
|
159
|
+
expect(exact_edge_length_km).to be_within(0.0001).of(expected)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
describe ".exact_edge_length_m" do
|
|
164
|
+
let(:cell) { "11928308280fffff".to_i(16) }
|
|
165
|
+
let(:expected) { 209.45858729823578 }
|
|
166
|
+
subject(:exact_edge_length_m) { H3.exact_edge_length_m(cell) }
|
|
167
|
+
|
|
168
|
+
it "returns edge length in m" do
|
|
169
|
+
expect(exact_edge_length_m).to be_within(0.0001).of(expected)
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
describe ".point_distance_rads" do
|
|
174
|
+
let(:a) { [41.3964809, 2.160444] }
|
|
175
|
+
let(:b) { [41.3870609, 2.164917] }
|
|
176
|
+
let(:expected) { 0.00017453024784008713 }
|
|
177
|
+
subject(:point_distance_rads) { H3.point_distance_rads(a, b) }
|
|
178
|
+
|
|
179
|
+
it "returns distance between points in rads" do
|
|
180
|
+
expect(point_distance_rads).to be_within(0.0001).of(expected)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
context "when the coordinates are invalid" do
|
|
184
|
+
let(:a) { [91, -18] }
|
|
185
|
+
|
|
186
|
+
it "raises an argument error" do
|
|
187
|
+
expect { point_distance_rads }.to raise_error(ArgumentError)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
describe ".point_distance_km" do
|
|
193
|
+
let(:a) { [41.3964809, 2.160444] }
|
|
194
|
+
let(:b) { [41.3870609, 2.164917] }
|
|
195
|
+
let(:expected) { 1.1119334622766763 }
|
|
196
|
+
subject(:point_distance_km) { H3.point_distance_km(a, b) }
|
|
197
|
+
|
|
198
|
+
it "returns distance between points in km" do
|
|
199
|
+
expect(point_distance_km).to be_within(0.0001).of(expected)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
context "when the coordinates are invalid" do
|
|
203
|
+
let(:a) { [89, -181] }
|
|
204
|
+
|
|
205
|
+
it "raises an argument error" do
|
|
206
|
+
expect { point_distance_km }.to raise_error(ArgumentError)
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
describe ".point_distance_m" do
|
|
212
|
+
let(:a) { [41.3964809, 2.160444] }
|
|
213
|
+
let(:b) { [41.3870609, 2.164917] }
|
|
214
|
+
let(:expected) { 1111.9334622766764 }
|
|
215
|
+
subject(:point_distance_m) { H3.point_distance_m(a, b) }
|
|
216
|
+
|
|
217
|
+
it "returns distance between points in m" do
|
|
218
|
+
expect(point_distance_m).to be_within(0.0001).of(expected)
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
context "when the coordinates are invalid" do
|
|
222
|
+
let(:a) { "boom" }
|
|
223
|
+
|
|
224
|
+
it "raises an argument error" do
|
|
225
|
+
expect { point_distance_m }.to raise_error(ArgumentError)
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
end
|
|
112
229
|
end
|
|
@@ -42,7 +42,7 @@ RSpec.describe H3 do
|
|
|
42
42
|
File.read(File.join(File.dirname(__FILE__), "support/fixtures/banbury.json"))
|
|
43
43
|
end
|
|
44
44
|
let(:resolution) { 9 }
|
|
45
|
-
let(:expected_count) {
|
|
45
|
+
let(:expected_count) { 47_018 }
|
|
46
46
|
|
|
47
47
|
subject(:max_polyfill_size) { H3.max_polyfill_size(geojson, resolution) }
|
|
48
48
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: h3
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lachlan Laycock
|
|
8
8
|
- Sean Handley
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: ffi
|
|
@@ -53,20 +53,6 @@ dependencies:
|
|
|
53
53
|
- - "~>"
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
55
|
version: '2.1'
|
|
56
|
-
- !ruby/object:Gem::Dependency
|
|
57
|
-
name: coveralls
|
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
|
59
|
-
requirements:
|
|
60
|
-
- - "~>"
|
|
61
|
-
- !ruby/object:Gem::Version
|
|
62
|
-
version: '0.8'
|
|
63
|
-
type: :development
|
|
64
|
-
prerelease: false
|
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
-
requirements:
|
|
67
|
-
- - "~>"
|
|
68
|
-
- !ruby/object:Gem::Version
|
|
69
|
-
version: '0.8'
|
|
70
56
|
- !ruby/object:Gem::Dependency
|
|
71
57
|
name: rake
|
|
72
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -109,7 +95,7 @@ dependencies:
|
|
|
109
95
|
- - "~>"
|
|
110
96
|
- !ruby/object:Gem::Version
|
|
111
97
|
version: '0.9'
|
|
112
|
-
description:
|
|
98
|
+
description:
|
|
113
99
|
email: l.laycock@stuart.com
|
|
114
100
|
executables: []
|
|
115
101
|
extensions:
|
|
@@ -117,11 +103,12 @@ extensions:
|
|
|
117
103
|
extra_rdoc_files: []
|
|
118
104
|
files:
|
|
119
105
|
- ".codeclimate.yml"
|
|
106
|
+
- ".github/workflows/ruby_ci.yml"
|
|
120
107
|
- ".gitignore"
|
|
121
108
|
- ".gitmodules"
|
|
122
109
|
- ".rspec"
|
|
123
110
|
- ".rubocop.yml"
|
|
124
|
-
- ".
|
|
111
|
+
- ".ruby-version"
|
|
125
112
|
- CHANGELOG.md
|
|
126
113
|
- CONTRIBUTING.md
|
|
127
114
|
- Gemfile
|
|
@@ -133,9 +120,12 @@ files:
|
|
|
133
120
|
- ext/h3/extconf.rb
|
|
134
121
|
- ext/h3/src/.clang-format
|
|
135
122
|
- ext/h3/src/.clang-tidy
|
|
123
|
+
- ext/h3/src/.github/workflows/test-linux.yml
|
|
124
|
+
- ext/h3/src/.github/workflows/test-macos.yml
|
|
125
|
+
- ext/h3/src/.github/workflows/test-website.yml
|
|
126
|
+
- ext/h3/src/.github/workflows/test-windows.yml
|
|
136
127
|
- ext/h3/src/.gitignore
|
|
137
128
|
- ext/h3/src/.travis.yml
|
|
138
|
-
- ext/h3/src/.ycm_extra_conf.py
|
|
139
129
|
- ext/h3/src/CHANGELOG.md
|
|
140
130
|
- ext/h3/src/CMakeLists.txt
|
|
141
131
|
- ext/h3/src/CONTRIBUTING.md
|
|
@@ -144,13 +134,20 @@ files:
|
|
|
144
134
|
- ext/h3/src/README.md
|
|
145
135
|
- ext/h3/src/RELEASE.md
|
|
146
136
|
- ext/h3/src/VERSION
|
|
147
|
-
- ext/h3/src/appveyor.yml
|
|
148
137
|
- ext/h3/src/cmake/Config.cmake.in
|
|
149
138
|
- ext/h3/src/cmake/TestWrapValgrind.cmake
|
|
150
139
|
- ext/h3/src/cmake/toolchain.cmake
|
|
151
140
|
- ext/h3/src/dev-docs/Doxyfile.in
|
|
141
|
+
- ext/h3/src/dev-docs/RFCs/rfc-template.md
|
|
142
|
+
- ext/h3/src/dev-docs/RFCs/v4.0.0/error-handling-rfc.md
|
|
143
|
+
- ext/h3/src/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md
|
|
144
|
+
- ext/h3/src/dev-docs/RFCs/v4.0.0/overrideable-allocators-rfc.md
|
|
145
|
+
- ext/h3/src/dev-docs/RFCs/v4.0.0/polyfill-modes-rfc.md
|
|
146
|
+
- ext/h3/src/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md
|
|
152
147
|
- ext/h3/src/dev-docs/build_windows.md
|
|
153
148
|
- ext/h3/src/dev-docs/creating_bindings.md
|
|
149
|
+
- ext/h3/src/dev-docs/custom_alloc.md
|
|
150
|
+
- ext/h3/src/docs/README.md
|
|
154
151
|
- ext/h3/src/docs/api/hierarchy.md
|
|
155
152
|
- ext/h3/src/docs/api/indexing.md
|
|
156
153
|
- ext/h3/src/docs/api/inspection.md
|
|
@@ -171,8 +168,8 @@ files:
|
|
|
171
168
|
- ext/h3/src/docs/core-library/overview.md
|
|
172
169
|
- ext/h3/src/docs/core-library/restable.md
|
|
173
170
|
- ext/h3/src/docs/core-library/usage.md
|
|
174
|
-
- ext/h3/src/docs/
|
|
175
|
-
- ext/h3/src/docs/
|
|
171
|
+
- ext/h3/src/docs/table-of-contents.json
|
|
172
|
+
- ext/h3/src/docs/usecases.md
|
|
176
173
|
- ext/h3/src/examples/CMakeLists.txt
|
|
177
174
|
- ext/h3/src/examples/compact.c
|
|
178
175
|
- ext/h3/src/examples/distance.c
|
|
@@ -196,6 +193,7 @@ files:
|
|
|
196
193
|
- ext/h3/src/src/apps/benchmarks/benchmarkH3Api.c
|
|
197
194
|
- ext/h3/src/src/apps/benchmarks/benchmarkH3Line.c
|
|
198
195
|
- ext/h3/src/src/apps/benchmarks/benchmarkH3SetToLinkedGeo.c
|
|
196
|
+
- ext/h3/src/src/apps/benchmarks/benchmarkH3UniEdge.c
|
|
199
197
|
- ext/h3/src/src/apps/benchmarks/benchmarkKRing.c
|
|
200
198
|
- ext/h3/src/src/apps/benchmarks/benchmarkPolyfill.c
|
|
201
199
|
- ext/h3/src/src/apps/benchmarks/benchmarkPolygon.c
|
|
@@ -210,6 +208,7 @@ files:
|
|
|
210
208
|
- ext/h3/src/src/apps/miscapps/generateBaseCellNeighbors.c
|
|
211
209
|
- ext/h3/src/src/apps/miscapps/generateFaceCenterPoint.c
|
|
212
210
|
- ext/h3/src/src/apps/miscapps/generateNumHexagons.c
|
|
211
|
+
- ext/h3/src/src/apps/miscapps/generatePentagonDirectionFaces.c
|
|
213
212
|
- ext/h3/src/src/apps/miscapps/h3ToGeoBoundaryHier.c
|
|
214
213
|
- ext/h3/src/src/apps/miscapps/h3ToGeoHier.c
|
|
215
214
|
- ext/h3/src/src/apps/miscapps/h3ToHier.c
|
|
@@ -224,12 +223,15 @@ files:
|
|
|
224
223
|
- ext/h3/src/src/apps/testapps/testGeoCoord.c
|
|
225
224
|
- ext/h3/src/src/apps/testapps/testGeoToH3.c
|
|
226
225
|
- ext/h3/src/src/apps/testapps/testH3Api.c
|
|
226
|
+
- ext/h3/src/src/apps/testapps/testH3CellArea.c
|
|
227
|
+
- ext/h3/src/src/apps/testapps/testH3CellAreaExhaustive.c
|
|
227
228
|
- ext/h3/src/src/apps/testapps/testH3Distance.c
|
|
228
229
|
- ext/h3/src/src/apps/testapps/testH3DistanceExhaustive.c
|
|
229
230
|
- ext/h3/src/src/apps/testapps/testH3GetFaces.c
|
|
230
231
|
- ext/h3/src/src/apps/testapps/testH3Index.c
|
|
231
232
|
- ext/h3/src/src/apps/testapps/testH3Line.c
|
|
232
233
|
- ext/h3/src/src/apps/testapps/testH3LineExhaustive.c
|
|
234
|
+
- ext/h3/src/src/apps/testapps/testH3Memory.c
|
|
233
235
|
- ext/h3/src/src/apps/testapps/testH3NeighborRotations.c
|
|
234
236
|
- ext/h3/src/src/apps/testapps/testH3SetToLinkedGeo.c
|
|
235
237
|
- ext/h3/src/src/apps/testapps/testH3SetToVertexGraph.c
|
|
@@ -241,6 +243,7 @@ files:
|
|
|
241
243
|
- ext/h3/src/src/apps/testapps/testH3ToLocalIjExhaustive.c
|
|
242
244
|
- ext/h3/src/src/apps/testapps/testH3ToParent.c
|
|
243
245
|
- ext/h3/src/src/apps/testapps/testH3UniEdge.c
|
|
246
|
+
- ext/h3/src/src/apps/testapps/testH3UniEdgeExhaustive.c
|
|
244
247
|
- ext/h3/src/src/apps/testapps/testHexRanges.c
|
|
245
248
|
- ext/h3/src/src/apps/testapps/testHexRing.c
|
|
246
249
|
- ext/h3/src/src/apps/testapps/testKRing.c
|
|
@@ -248,11 +251,14 @@ files:
|
|
|
248
251
|
- ext/h3/src/src/apps/testapps/testMaxH3ToChildrenSize.c
|
|
249
252
|
- ext/h3/src/src/apps/testapps/testPentagonIndexes.c
|
|
250
253
|
- ext/h3/src/src/apps/testapps/testPolyfill.c
|
|
254
|
+
- ext/h3/src/src/apps/testapps/testPolyfillReported.c
|
|
251
255
|
- ext/h3/src/src/apps/testapps/testPolygon.c
|
|
252
256
|
- ext/h3/src/src/apps/testapps/testVec2d.c
|
|
253
257
|
- ext/h3/src/src/apps/testapps/testVec3d.c
|
|
258
|
+
- ext/h3/src/src/apps/testapps/testVertex.c
|
|
254
259
|
- ext/h3/src/src/apps/testapps/testVertexGraph.c
|
|
255
260
|
- ext/h3/src/src/h3lib/include/algos.h
|
|
261
|
+
- ext/h3/src/src/h3lib/include/alloc.h
|
|
256
262
|
- ext/h3/src/src/h3lib/include/baseCells.h
|
|
257
263
|
- ext/h3/src/src/h3lib/include/bbox.h
|
|
258
264
|
- ext/h3/src/src/h3lib/include/constants.h
|
|
@@ -269,6 +275,7 @@ files:
|
|
|
269
275
|
- ext/h3/src/src/h3lib/include/polygonAlgos.h
|
|
270
276
|
- ext/h3/src/src/h3lib/include/vec2d.h
|
|
271
277
|
- ext/h3/src/src/h3lib/include/vec3d.h
|
|
278
|
+
- ext/h3/src/src/h3lib/include/vertex.h
|
|
272
279
|
- ext/h3/src/src/h3lib/include/vertexGraph.h
|
|
273
280
|
- ext/h3/src/src/h3lib/lib/algos.c
|
|
274
281
|
- ext/h3/src/src/h3lib/lib/baseCells.c
|
|
@@ -284,6 +291,7 @@ files:
|
|
|
284
291
|
- ext/h3/src/src/h3lib/lib/polygon.c
|
|
285
292
|
- ext/h3/src/src/h3lib/lib/vec2d.c
|
|
286
293
|
- ext/h3/src/src/h3lib/lib/vec3d.c
|
|
294
|
+
- ext/h3/src/src/h3lib/lib/vertex.c
|
|
287
295
|
- ext/h3/src/src/h3lib/lib/vertexGraph.c
|
|
288
296
|
- ext/h3/src/tests/inputfiles/bc05r08cells.txt
|
|
289
297
|
- ext/h3/src/tests/inputfiles/bc05r08centers.txt
|
|
@@ -364,14 +372,14 @@ files:
|
|
|
364
372
|
- ext/h3/src/tests/inputfiles/res03cells.txt
|
|
365
373
|
- ext/h3/src/tests/inputfiles/res03ic.txt
|
|
366
374
|
- ext/h3/src/tests/inputfiles/res04ic.txt
|
|
375
|
+
- ext/h3/src/website/.eslintignore
|
|
376
|
+
- ext/h3/src/website/.gitignore
|
|
377
|
+
- ext/h3/src/website/.nvmrc
|
|
367
378
|
- ext/h3/src/website/README.md
|
|
368
|
-
- ext/h3/src/website/
|
|
379
|
+
- ext/h3/src/website/gatsby-config.js
|
|
369
380
|
- ext/h3/src/website/package.json
|
|
370
381
|
- ext/h3/src/website/scripts/build-to-gh-pages.sh
|
|
371
|
-
- ext/h3/src/website/src
|
|
372
|
-
- ext/h3/src/website/src/mdRoutes.js
|
|
373
|
-
- ext/h3/src/website/src/styles/_variables.scss
|
|
374
|
-
- ext/h3/src/website/src/styles/index.scss
|
|
382
|
+
- ext/h3/src/website/src/.gitkeep
|
|
375
383
|
- ext/h3/src/website/static/favicon.ico
|
|
376
384
|
- ext/h3/src/website/static/images/ca_compact_6_901.png
|
|
377
385
|
- ext/h3/src/website/static/images/ca_uncompact_6_10633.png
|
|
@@ -390,7 +398,8 @@ files:
|
|
|
390
398
|
- ext/h3/src/website/static/images/substrate3.png
|
|
391
399
|
- ext/h3/src/website/static/images/triEdge.png
|
|
392
400
|
- ext/h3/src/website/static/images/uber-logo.png
|
|
393
|
-
- ext/h3/src/website/
|
|
401
|
+
- ext/h3/src/website/templates/documentation.jsx
|
|
402
|
+
- ext/h3/src/website/yarn.lock
|
|
394
403
|
- h3.gemspec
|
|
395
404
|
- lib/h3.rb
|
|
396
405
|
- lib/h3/bindings/base.rb
|
|
@@ -411,7 +420,7 @@ files:
|
|
|
411
420
|
- spec/indexing_spec.rb
|
|
412
421
|
- spec/inspection_spec.rb
|
|
413
422
|
- spec/miscellaneous_spec.rb
|
|
414
|
-
- spec/
|
|
423
|
+
- spec/regions_spec.rb
|
|
415
424
|
- spec/spec_helper.rb
|
|
416
425
|
- spec/support/fixtures/australia.json
|
|
417
426
|
- spec/support/fixtures/banbury.json
|
|
@@ -426,24 +435,23 @@ homepage: https://github.com/StuartApp/h3_ruby
|
|
|
426
435
|
licenses:
|
|
427
436
|
- MIT
|
|
428
437
|
metadata: {}
|
|
429
|
-
post_install_message:
|
|
438
|
+
post_install_message:
|
|
430
439
|
rdoc_options: []
|
|
431
440
|
require_paths:
|
|
432
441
|
- lib
|
|
433
442
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
434
443
|
requirements:
|
|
435
|
-
- - "
|
|
444
|
+
- - ">="
|
|
436
445
|
- !ruby/object:Gem::Version
|
|
437
|
-
version: '2.
|
|
446
|
+
version: '2.5'
|
|
438
447
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
439
448
|
requirements:
|
|
440
449
|
- - ">="
|
|
441
450
|
- !ruby/object:Gem::Version
|
|
442
451
|
version: '0'
|
|
443
452
|
requirements: []
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
signing_key:
|
|
453
|
+
rubygems_version: 3.1.4
|
|
454
|
+
signing_key:
|
|
447
455
|
specification_version: 4
|
|
448
456
|
summary: C Bindings for Uber's H3 library
|
|
449
457
|
test_files: []
|