h3 3.5.0 → 3.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +45 -0
- data/Gemfile.lock +9 -7
- data/README.md +8 -8
- 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 +21 -32
- data/ext/h3/src/CHANGELOG.md +60 -0
- data/ext/h3/src/CMakeLists.txt +150 -33
- data/ext/h3/src/CONTRIBUTING.md +1 -1
- data/ext/h3/src/README.md +65 -16
- 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/hierarchy.md +8 -0
- data/ext/h3/src/docs/api/misc.md +94 -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 +8 -4
- 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/generateBaseCellNeighbors.c +2 -2
- data/ext/h3/src/src/apps/miscapps/generateFaceCenterPoint.c +1 -0
- data/ext/h3/src/src/apps/miscapps/generateNumHexagons.c +1 -2
- 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 +121 -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 +2 -50
- data/ext/h3/src/src/apps/testapps/testH3DistanceExhaustive.c +84 -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 +2 -84
- data/ext/h3/src/src/apps/testapps/testH3LineExhaustive.c +115 -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 +68 -0
- data/ext/h3/src/src/apps/testapps/testH3ToChildren.c +15 -2
- 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 +24 -236
- data/ext/h3/src/src/apps/testapps/testH3ToLocalIjExhaustive.c +265 -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 +1 -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 +58 -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/constants.h +2 -0
- 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 +85 -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 +305 -80
- 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 +35 -24
- data/ext/h3/src/src/h3lib/lib/geoCoord.c +162 -44
- data/ext/h3/src/src/h3lib/lib/h3Index.c +150 -46
- 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 +5 -5
- data/ext/h3/src/src/h3lib/lib/polygon.c +3 -2
- 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 +1 -0
- data/lib/h3.rb +8 -23
- data/lib/h3/bindings/base.rb +15 -4
- data/lib/h3/bindings/private.rb +13 -9
- data/lib/h3/geo_json.rb +1 -1
- data/lib/h3/hierarchy.rb +24 -9
- data/lib/h3/indexing.rb +7 -7
- data/lib/h3/inspection.rb +22 -26
- data/lib/h3/miscellaneous.rb +157 -9
- data/lib/h3/regions.rb +3 -0
- data/lib/h3/traversal.rb +9 -9
- data/lib/h3/unidirectional_edges.rb +18 -18
- data/lib/h3/version.rb +1 -1
- data/spec/geo_json_spec.rb +8 -0
- data/spec/hierarchy_spec.rb +23 -13
- data/spec/indexing_spec.rb +15 -15
- data/spec/inspection_spec.rb +17 -17
- data/spec/miscellaneous_spec.rb +151 -6
- data/spec/{region_spec.rb → regions_spec.rb} +1 -1
- data/spec/traversal_spec.rb +6 -6
- data/spec/unidirectional_edges_spec.rb +18 -18
- metadata +55 -15
- 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/bindings.rb +0 -12
data/ext/h3/src/CHANGELOG.md
CHANGED
@@ -7,6 +7,66 @@ The public API of this library consists of the functions declared in file
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [3.7.1] - 2020-10-05
|
11
|
+
### Fixed
|
12
|
+
- Finding invalid edge boundaries should not crash. (#399)
|
13
|
+
- Build fixes for FreeBSD. (#397)
|
14
|
+
|
15
|
+
## [3.7.0] - 2020-09-28
|
16
|
+
### Added
|
17
|
+
- Area and haversine distance functions (#377):
|
18
|
+
- `cellAreaRads2`
|
19
|
+
- `cellAreaKm2`
|
20
|
+
- `cellAreaM2`
|
21
|
+
- `pointDistRads`
|
22
|
+
- `pointDistKm`
|
23
|
+
- `pointDistM`
|
24
|
+
- `exactEdgeLengthRads`
|
25
|
+
- `exactEdgeLengthKm`
|
26
|
+
- `exactEdgeLengthM`
|
27
|
+
- Refactor `getH3UnidirectionalEdgeBoundary` for accuracy at small resolutions. (#391)
|
28
|
+
- Speeds up `getH3UnidirectionalEdgeBoundary` by about 3x.
|
29
|
+
- Implement core logic for future vertex mode.
|
30
|
+
### Fixed
|
31
|
+
- Fixed building the library with custom memory allocation functions on Mac OSX. (#362)
|
32
|
+
- The installed H3 CMake target should have include directories specified. (#381)
|
33
|
+
### Changed
|
34
|
+
- Tests now use `bash` on Windows. (#381)
|
35
|
+
|
36
|
+
## [3.6.4] - 2020-06-19
|
37
|
+
### Added
|
38
|
+
- `H3_MEMORY_PREFIX` CMake option for replacing the memory management functions used in H3. (#317)
|
39
|
+
- Support for building Debian packages of H3. (#352)
|
40
|
+
### Fixed
|
41
|
+
- Removed duplicate include statements. (#333)
|
42
|
+
- Fixed macro `H3_DIGIT_MASK_NEGATIVE`. (#329)
|
43
|
+
## Changed
|
44
|
+
- Again implement new `polyfill` algorithm. (#313)
|
45
|
+
|
46
|
+
## [3.6.3] - 2020-01-21
|
47
|
+
### Fixed
|
48
|
+
- `compact` detects and fails on cases with duplicated input indexes. (#299)
|
49
|
+
### Changed
|
50
|
+
- `h3IsValid` returns false for indexes that have non-zero reserved bits. (#300)
|
51
|
+
- `h3IsValid` and `h3UnidirectionalEdgeIsValid` return false for indexes with the high bit set. (#300)
|
52
|
+
|
53
|
+
## [3.6.2] - 2019-12-9
|
54
|
+
- Revert new `polyfill` algorithm until reported issues are fixed. (#293)
|
55
|
+
|
56
|
+
## [3.6.1] - 2019-11-11
|
57
|
+
### Fixed
|
58
|
+
- `compact` handles zero length input correctly. (#278)
|
59
|
+
- `bboxHexRadius` scaling factor adjusted to guarantee containment for `polyfill`. (#279)
|
60
|
+
- `polyfill` new algorithm for up to 3x perf boost. (#282)
|
61
|
+
- Fix CMake targets for KML generation. (#285)
|
62
|
+
|
63
|
+
## [3.6.0] - 2019-08-12
|
64
|
+
### Added
|
65
|
+
- `h3ToCenterChild` function to find center child at given resolution (#267)
|
66
|
+
- `getPentagonIndexes` (and `pentagonIndexCount`) function to find pentagons at given resolution (#267)
|
67
|
+
### Fixed
|
68
|
+
- Fix bounds check for local IJ coordinates (#271)
|
69
|
+
|
10
70
|
## [3.5.0] - 2019-07-22
|
11
71
|
### Added
|
12
72
|
- CMake options for excluding filter applications or benchmarks from the build. (#247)
|
data/ext/h3/src/CMakeLists.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2017-
|
1
|
+
# Copyright 2017-2020 Uber Technologies, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -15,6 +15,7 @@
|
|
15
15
|
cmake_minimum_required(VERSION 3.1)
|
16
16
|
|
17
17
|
set(H3_PREFIX "" CACHE STRING "Prefix for exported symbols")
|
18
|
+
set(H3_ALLOC_PREFIX "" CACHE STRING "Prefix for allocation functions")
|
18
19
|
|
19
20
|
# Needed due to CMP0042
|
20
21
|
set(CMAKE_MACOSX_RPATH 1)
|
@@ -34,7 +35,8 @@ option(BUILD_FILTERS "Build filter applications." ON)
|
|
34
35
|
option(BUILD_GENERATORS "Build code generation applications." ON)
|
35
36
|
|
36
37
|
if(WIN32)
|
37
|
-
|
38
|
+
# Use bash (usually from Git for Windows) for piping results
|
39
|
+
set(SHELL bash -c)
|
38
40
|
|
39
41
|
set(EXECUTABLE_OUTPUT_PATH bin)
|
40
42
|
set(LIBRARY_OUTPUT_PATH bin)
|
@@ -107,6 +109,7 @@ set(LIB_SOURCE_FILES
|
|
107
109
|
src/h3lib/lib/h3Index.c
|
108
110
|
src/h3lib/lib/vec2d.c
|
109
111
|
src/h3lib/lib/vec3d.c
|
112
|
+
src/h3lib/lib/vertex.c
|
110
113
|
src/h3lib/lib/linkedGeo.c
|
111
114
|
src/h3lib/lib/localij.c
|
112
115
|
src/h3lib/lib/geoCoord.c
|
@@ -143,6 +146,8 @@ set(OTHER_SOURCE_FILES
|
|
143
146
|
src/apps/testapps/testVertexGraph.c
|
144
147
|
src/apps/testapps/testCompact.c
|
145
148
|
src/apps/testapps/testPolyfill.c
|
149
|
+
src/apps/testapps/testPolyfillReported.c
|
150
|
+
src/apps/testapps/testPentagonIndexes.c
|
146
151
|
src/apps/testapps/testKRing.c
|
147
152
|
src/apps/testapps/testH3ToGeoBoundary.c
|
148
153
|
src/apps/testapps/testH3ToParent.c
|
@@ -153,28 +158,38 @@ set(OTHER_SOURCE_FILES
|
|
153
158
|
src/apps/testapps/testMaxH3ToChildrenSize.c
|
154
159
|
src/apps/testapps/testHexRanges.c
|
155
160
|
src/apps/testapps/testH3ToGeo.c
|
161
|
+
src/apps/testapps/testH3ToCenterChild.c
|
156
162
|
src/apps/testapps/testH3ToChildren.c
|
157
163
|
src/apps/testapps/testH3GetFaces.c
|
158
164
|
src/apps/testapps/testGeoCoord.c
|
159
165
|
src/apps/testapps/testHexRing.c
|
160
166
|
src/apps/testapps/testH3SetToVertexGraph.c
|
161
167
|
src/apps/testapps/testBBox.c
|
168
|
+
src/apps/testapps/testVertex.c
|
162
169
|
src/apps/testapps/testPolygon.c
|
163
170
|
src/apps/testapps/testVec2d.c
|
164
171
|
src/apps/testapps/testVec3d.c
|
165
172
|
src/apps/testapps/testH3UniEdge.c
|
173
|
+
src/apps/testapps/testH3UniEdgeExhaustive.c
|
166
174
|
src/apps/testapps/testLinkedGeo.c
|
167
175
|
src/apps/testapps/mkRandGeo.c
|
168
176
|
src/apps/testapps/testH3Api.c
|
169
177
|
src/apps/testapps/testH3SetToLinkedGeo.c
|
170
178
|
src/apps/testapps/testH3ToLocalIj.c
|
179
|
+
src/apps/testapps/testH3ToLocalIjExhaustive.c
|
171
180
|
src/apps/testapps/testH3Distance.c
|
181
|
+
src/apps/testapps/testH3DistanceExhaustive.c
|
172
182
|
src/apps/testapps/testH3Line.c
|
183
|
+
src/apps/testapps/testH3LineExhaustive.c
|
184
|
+
src/apps/testapps/testH3CellArea.c
|
185
|
+
src/apps/testapps/testH3CellAreaExhaustive.c
|
173
186
|
src/apps/testapps/testCoordIj.c
|
174
187
|
src/apps/testapps/testCoordIjk.c
|
188
|
+
src/apps/testapps/testH3Memory.c
|
175
189
|
src/apps/miscapps/h3ToGeoBoundaryHier.c
|
176
190
|
src/apps/miscapps/h3ToGeoHier.c
|
177
191
|
src/apps/miscapps/generateBaseCellNeighbors.c
|
192
|
+
src/apps/miscapps/generatePentagonDirectionFaces.c
|
178
193
|
src/apps/miscapps/generateNumHexagons.c
|
179
194
|
src/apps/miscapps/generateFaceCenterPoint.c
|
180
195
|
src/apps/miscapps/h3ToHier.c
|
@@ -183,6 +198,7 @@ set(OTHER_SOURCE_FILES
|
|
183
198
|
src/apps/benchmarks/benchmarkH3SetToLinkedGeo.c
|
184
199
|
src/apps/benchmarks/benchmarkKRing.c
|
185
200
|
src/apps/benchmarks/benchmarkH3Line.c
|
201
|
+
src/apps/benchmarks/benchmarkH3UniEdge.c
|
186
202
|
src/apps/benchmarks/benchmarkH3Api.c)
|
187
203
|
|
188
204
|
set(ALL_SOURCE_FILES
|
@@ -192,36 +208,55 @@ set(UNCONFIGURED_API_HEADER src/h3lib/include/h3api.h.in)
|
|
192
208
|
set(CONFIGURED_API_HEADER src/h3lib/include/h3api.h)
|
193
209
|
configure_file(${UNCONFIGURED_API_HEADER} ${CONFIGURED_API_HEADER})
|
194
210
|
|
195
|
-
set(INSTALL_TARGETS
|
211
|
+
set(INSTALL_TARGETS)
|
196
212
|
|
197
|
-
|
198
|
-
add_library(
|
213
|
+
function(add_h3_library name h3_alloc_prefix_override)
|
214
|
+
add_library(${name} ${LIB_SOURCE_FILES} ${CONFIGURED_API_HEADER})
|
199
215
|
|
200
|
-
target_compile_options(
|
201
|
-
target_link_libraries(
|
216
|
+
target_compile_options(${name} PRIVATE ${H3_COMPILE_FLAGS})
|
217
|
+
target_link_libraries(${name} PRIVATE ${H3_LINK_FLAGS})
|
202
218
|
|
203
|
-
find_library(M_LIB m)
|
204
|
-
if(M_LIB)
|
205
|
-
|
206
|
-
endif()
|
219
|
+
find_library(M_LIB m)
|
220
|
+
if(M_LIB)
|
221
|
+
target_link_libraries(${name} PUBLIC ${M_LIB})
|
222
|
+
endif()
|
207
223
|
|
208
|
-
if(BUILD_SHARED_LIBS)
|
209
|
-
|
210
|
-
endif()
|
224
|
+
if(BUILD_SHARED_LIBS)
|
225
|
+
set_target_properties(${name} PROPERTIES SOVERSION ${H3_SOVERSION})
|
226
|
+
endif()
|
211
227
|
|
212
|
-
target_compile_definitions(
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
228
|
+
target_compile_definitions(${name} PUBLIC H3_PREFIX=${H3_PREFIX})
|
229
|
+
set(has_alloc_prefix NO)
|
230
|
+
if(h3_alloc_prefix_override)
|
231
|
+
set(has_alloc_prefix YES)
|
232
|
+
target_compile_definitions(${name} PUBLIC H3_ALLOC_PREFIX=${h3_alloc_prefix_override})
|
233
|
+
elseif(H3_ALLOC_PREFIX)
|
234
|
+
set(has_alloc_prefix YES)
|
235
|
+
target_compile_definitions(${name} PUBLIC H3_ALLOC_PREFIX=${H3_ALLOC_PREFIX})
|
236
|
+
endif()
|
237
|
+
# Mac OSX defaults to not looking up undefined symbols dynamically,
|
238
|
+
# so enable that explicitly.
|
239
|
+
if(has_alloc_prefix AND APPLE)
|
240
|
+
target_link_libraries(${name} PRIVATE "-undefined dynamic_lookup")
|
241
|
+
endif()
|
242
|
+
|
243
|
+
if(have_alloca)
|
244
|
+
target_compile_definitions(${name} PUBLIC H3_HAVE_ALLOCA)
|
245
|
+
endif()
|
246
|
+
if(have_vla)
|
247
|
+
target_compile_definitions(${name} PUBLIC H3_HAVE_VLA)
|
248
|
+
endif()
|
249
|
+
target_include_directories(${name} PUBLIC
|
250
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/h3lib/include>
|
251
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src/h3lib/include>)
|
252
|
+
endfunction()
|
253
|
+
|
254
|
+
# Build the H3 library
|
255
|
+
add_h3_library(h3 "")
|
222
256
|
|
223
257
|
# Automatic code formatting
|
224
|
-
|
258
|
+
# Give preference to clang-format-9
|
259
|
+
find_program(CLANG_FORMAT_PATH NAMES clang-format-9 clang-format)
|
225
260
|
cmake_dependent_option(
|
226
261
|
ENABLE_FORMAT "Enable running clang-format before compiling" ON
|
227
262
|
"CLANG_FORMAT_PATH" OFF)
|
@@ -344,11 +379,11 @@ if(BUILD_FILTERS)
|
|
344
379
|
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "KML/res${resolution}cells.kml")
|
345
380
|
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "KML/res${resolution}centers.kml")
|
346
381
|
add_custom_target(kml_cells_${resolution}
|
347
|
-
COMMAND ${SHELL} "$<TARGET_FILE:h3ToHier> ${resolution} | $<TARGET_FILE:h3ToGeoBoundary>
|
382
|
+
COMMAND ${SHELL} "$<TARGET_FILE:h3ToHier> -r ${resolution} | $<TARGET_FILE:h3ToGeoBoundary> --kml --kml-name res${resolution}cells.kml --kml-description \"Res ${resolution} Cells\" > KML/res${resolution}cells.kml"
|
348
383
|
VERBATIM
|
349
384
|
DEPENDS create-kml-dir)
|
350
385
|
add_custom_target(kml_centers_${resolution}
|
351
|
-
COMMAND ${SHELL} "$<TARGET_FILE:h3ToHier> ${resolution} | $<TARGET_FILE:h3ToGeo>
|
386
|
+
COMMAND ${SHELL} "$<TARGET_FILE:h3ToHier> -r ${resolution} | $<TARGET_FILE:h3ToGeo> --kml --kml-name res${resolution}centers.kml --kml-description \"Res ${resolution} Centers\" > KML/res${resolution}centers.kml"
|
352
387
|
VERBATIM
|
353
388
|
DEPENDS create-kml-dir)
|
354
389
|
add_dependencies(kml
|
@@ -360,6 +395,7 @@ endif()
|
|
360
395
|
if(BUILD_GENERATORS)
|
361
396
|
# Code generation
|
362
397
|
add_h3_executable(generateBaseCellNeighbors src/apps/miscapps/generateBaseCellNeighbors.c ${APP_SOURCE_FILES})
|
398
|
+
add_h3_executable(generatePentagonDirectionFaces src/apps/miscapps/generatePentagonDirectionFaces.c ${APP_SOURCE_FILES})
|
363
399
|
add_h3_executable(generateNumHexagons src/apps/miscapps/generateNumHexagons.c ${APP_SOURCE_FILES})
|
364
400
|
add_h3_executable(generateFaceCenterPoint src/apps/miscapps/generateFaceCenterPoint.c ${APP_SOURCE_FILES})
|
365
401
|
|
@@ -393,6 +429,37 @@ if(BUILD_TESTING)
|
|
393
429
|
)
|
394
430
|
endif()
|
395
431
|
|
432
|
+
add_h3_library(h3WithTestAllocators test_prefix_)
|
433
|
+
|
434
|
+
macro(add_h3_memory_test name srcfile)
|
435
|
+
# Like other test code, but these need to be linked against
|
436
|
+
# a different copy of the H3 library which has known intercepted
|
437
|
+
# allocator functions.
|
438
|
+
add_executable(${ARGV} ${APP_SOURCE_FILES})
|
439
|
+
|
440
|
+
if(TARGET ${name})
|
441
|
+
target_link_libraries(${name} PUBLIC h3WithTestAllocators)
|
442
|
+
target_include_directories(${name} PUBLIC
|
443
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/apps/applib/include>)
|
444
|
+
target_compile_options(${name} PRIVATE ${H3_COMPILE_FLAGS})
|
445
|
+
target_link_libraries(${name} PRIVATE ${H3_LINK_FLAGS})
|
446
|
+
endif()
|
447
|
+
|
448
|
+
math(EXPR test_number "${test_number}+1")
|
449
|
+
|
450
|
+
add_test(NAME ${name}_test${test_number} COMMAND ${TEST_WRAPPER} "$<TARGET_FILE:${name}>")
|
451
|
+
|
452
|
+
if(ENABLE_COVERAGE)
|
453
|
+
add_custom_target(${name}_coverage${test_number}
|
454
|
+
COMMAND ${name} > /dev/null
|
455
|
+
COMMENT "Running ${name}_coverage${test_number}"
|
456
|
+
)
|
457
|
+
|
458
|
+
add_dependencies(coverage ${name}_coverage${test_number})
|
459
|
+
add_dependencies(${name}_coverage${test_number} clean-coverage)
|
460
|
+
endif()
|
461
|
+
endmacro()
|
462
|
+
|
396
463
|
macro(add_h3_test_common name srcfile)
|
397
464
|
# need to actually make the test target
|
398
465
|
if(NOT TARGET ${name})
|
@@ -420,11 +487,7 @@ if(BUILD_TESTING)
|
|
420
487
|
macro(add_h3_test_with_file name srcfile argfile)
|
421
488
|
add_h3_test_common(${name} ${srcfile})
|
422
489
|
# add a special command (so we don't need to read the test file from the test program)
|
423
|
-
|
424
|
-
set(dump_command "Get-Content")
|
425
|
-
else()
|
426
|
-
set(dump_command "cat")
|
427
|
-
endif()
|
490
|
+
set(dump_command "cat")
|
428
491
|
|
429
492
|
add_test(NAME ${name}_test${test_number}
|
430
493
|
COMMAND ${SHELL} "${dump_command} ${argfile} | ${TEST_WRAPPER_STR} $<TARGET_FILE:${name}>")
|
@@ -465,7 +528,6 @@ if(BUILD_TESTING)
|
|
465
528
|
endmacro()
|
466
529
|
|
467
530
|
# Add each individual test
|
468
|
-
|
469
531
|
file(GLOB all_centers tests/inputfiles/bc*centers.txt)
|
470
532
|
foreach(file ${all_centers})
|
471
533
|
add_h3_test_with_file(testH3ToGeo src/apps/testapps/testH3ToGeo.c ${file})
|
@@ -491,6 +553,7 @@ if(BUILD_TESTING)
|
|
491
553
|
add_h3_test(testHexRing src/apps/testapps/testHexRing.c)
|
492
554
|
add_h3_test(testHexRanges src/apps/testapps/testHexRanges.c)
|
493
555
|
add_h3_test(testH3ToParent src/apps/testapps/testH3ToParent.c)
|
556
|
+
add_h3_test(testH3ToCenterChild src/apps/testapps/testH3ToCenterChild.c)
|
494
557
|
add_h3_test(testH3ToChildren src/apps/testapps/testH3ToChildren.c)
|
495
558
|
add_h3_test(testH3GetFaces src/apps/testapps/testH3GetFaces.c)
|
496
559
|
add_h3_test(testMaxH3ToChildrenSize src/apps/testapps/testMaxH3ToChildrenSize.c)
|
@@ -500,23 +563,39 @@ if(BUILD_TESTING)
|
|
500
563
|
add_h3_test(testH3SetToVertexGraph src/apps/testapps/testH3SetToVertexGraph.c)
|
501
564
|
add_h3_test(testLinkedGeo src/apps/testapps/testLinkedGeo.c)
|
502
565
|
add_h3_test(testPolyfill src/apps/testapps/testPolyfill.c)
|
566
|
+
add_h3_test(testPolyfillReported src/apps/testapps/testPolyfillReported.c)
|
503
567
|
add_h3_test(testVertexGraph src/apps/testapps/testVertexGraph.c)
|
504
568
|
add_h3_test(testH3UniEdge src/apps/testapps/testH3UniEdge.c)
|
505
569
|
add_h3_test(testGeoCoord src/apps/testapps/testGeoCoord.c)
|
506
570
|
add_h3_test(testBBox src/apps/testapps/testBBox.c)
|
571
|
+
add_h3_test(testVertex src/apps/testapps/testVertex.c)
|
507
572
|
add_h3_test(testPolygon src/apps/testapps/testPolygon.c)
|
508
573
|
add_h3_test(testVec2d src/apps/testapps/testVec2d.c)
|
509
574
|
add_h3_test(testVec3d src/apps/testapps/testVec3d.c)
|
510
575
|
add_h3_test(testH3ToLocalIj src/apps/testapps/testH3ToLocalIj.c)
|
511
576
|
add_h3_test(testH3Distance src/apps/testapps/testH3Distance.c)
|
512
577
|
add_h3_test(testH3Line src/apps/testapps/testH3Line.c)
|
578
|
+
add_h3_test(testH3CellArea src/apps/testapps/testH3CellArea.c)
|
513
579
|
add_h3_test(testCoordIj src/apps/testapps/testCoordIj.c)
|
514
580
|
add_h3_test(testCoordIjk src/apps/testapps/testCoordIjk.c)
|
515
581
|
add_h3_test(testBaseCells src/apps/testapps/testBaseCells.c)
|
582
|
+
add_h3_test(testPentagonIndexes src/apps/testapps/testPentagonIndexes.c)
|
516
583
|
|
517
584
|
add_h3_test_with_arg(testH3NeighborRotations src/apps/testapps/testH3NeighborRotations.c 0)
|
518
585
|
add_h3_test_with_arg(testH3NeighborRotations src/apps/testapps/testH3NeighborRotations.c 1)
|
519
586
|
add_h3_test_with_arg(testH3NeighborRotations src/apps/testapps/testH3NeighborRotations.c 2)
|
587
|
+
|
588
|
+
# The "Exhaustive" part of the test name is used by the test-fast to exclude these files.
|
589
|
+
# test-fast exists so that Travis CI can run Valgrind on tests without taking a very long time.
|
590
|
+
add_h3_test(testH3UniEdgeExhaustive src/apps/testapps/testH3UniEdgeExhaustive.c)
|
591
|
+
add_h3_test(testH3ToLocalIjExhaustive src/apps/testapps/testH3ToLocalIjExhaustive.c)
|
592
|
+
add_h3_test(testH3LineExhaustive src/apps/testapps/testH3LineExhaustive.c)
|
593
|
+
add_h3_test(testH3DistanceExhaustive src/apps/testapps/testH3DistanceExhaustive.c)
|
594
|
+
add_h3_test(testH3CellAreaExhaustive src/apps/testapps/testH3CellAreaExhaustive.c)
|
595
|
+
|
596
|
+
add_h3_memory_test(testH3Memory src/apps/testapps/testH3Memory.c)
|
597
|
+
|
598
|
+
add_custom_target(test-fast COMMAND ctest -E Exhaustive)
|
520
599
|
endif()
|
521
600
|
|
522
601
|
if(BUILD_BENCHMARKS)
|
@@ -532,6 +611,7 @@ if(BUILD_BENCHMARKS)
|
|
532
611
|
add_h3_benchmark(benchmarkH3Api src/apps/benchmarks/benchmarkH3Api.c)
|
533
612
|
add_h3_benchmark(benchmarkKRing src/apps/benchmarks/benchmarkKRing.c)
|
534
613
|
add_h3_benchmark(benchmarkH3Line src/apps/benchmarks/benchmarkH3Line.c)
|
614
|
+
add_h3_benchmark(benchmarkH3UniEdge src/apps/benchmarks/benchmarkH3UniEdge.c)
|
535
615
|
add_h3_benchmark(benchmarkH3SetToLinkedGeo src/apps/benchmarks/benchmarkH3SetToLinkedGeo.c)
|
536
616
|
add_h3_benchmark(benchmarkPolyfill src/apps/benchmarks/benchmarkPolyfill.c)
|
537
617
|
add_h3_benchmark(benchmarkPolygon src/apps/benchmarks/benchmarkPolygon.c)
|
@@ -554,6 +634,10 @@ set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
|
|
554
634
|
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
555
635
|
set(namespace "${PROJECT_NAME}::")
|
556
636
|
|
637
|
+
# TODO: Unclear why this is needed to get the libh3 Debian package to build correctly
|
638
|
+
# with shared libraries.
|
639
|
+
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "libh3")
|
640
|
+
|
557
641
|
# Include module with fuction 'write_basic_package_version_file'
|
558
642
|
include(CMakePackageConfigHelpers)
|
559
643
|
|
@@ -582,6 +666,14 @@ configure_package_config_file(
|
|
582
666
|
install(
|
583
667
|
TARGETS ${INSTALL_TARGETS}
|
584
668
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
669
|
+
RUNTIME DESTINATION "bin"
|
670
|
+
COMPONENT h3
|
671
|
+
)
|
672
|
+
|
673
|
+
install(
|
674
|
+
TARGETS h3
|
675
|
+
EXPORT "${TARGETS_EXPORT_NAME}"
|
676
|
+
COMPONENT libh3
|
585
677
|
LIBRARY DESTINATION "lib"
|
586
678
|
ARCHIVE DESTINATION "lib"
|
587
679
|
RUNTIME DESTINATION "bin"
|
@@ -594,6 +686,7 @@ install(
|
|
594
686
|
install(
|
595
687
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/src/h3lib/include/h3api.h"
|
596
688
|
DESTINATION "${include_install_dir}/h3"
|
689
|
+
COMPONENT libh3-dev
|
597
690
|
)
|
598
691
|
|
599
692
|
# Config
|
@@ -602,6 +695,7 @@ install(
|
|
602
695
|
install(
|
603
696
|
FILES "${project_config}" "${version_config}"
|
604
697
|
DESTINATION "${config_install_dir}"
|
698
|
+
COMPONENT libh3-dev
|
605
699
|
)
|
606
700
|
|
607
701
|
# Config
|
@@ -610,4 +704,27 @@ install(
|
|
610
704
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
611
705
|
NAMESPACE "${namespace}"
|
612
706
|
DESTINATION "${config_install_dir}"
|
707
|
+
COMPONENT libh3-dev
|
613
708
|
)
|
709
|
+
|
710
|
+
# Debian package build
|
711
|
+
set(CPACK_DEB_COMPONENT_INSTALL 1)
|
712
|
+
set(CPACK_GENERATOR "DEB")
|
713
|
+
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
714
|
+
# set(CPACK_DEBIAN_PACKAGE_MAINTAINER "TEST PACKAGE") # Required
|
715
|
+
set(CPACK_PACKAGE_HOMEPAGE_URL "https://www.h3geo.org")
|
716
|
+
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
717
|
+
set(CPACK_DEBIAN_LIBH3_PACKAGE_DEPENDS "libc6 (>= 2.27)")
|
718
|
+
set(CPACK_DEBIAN_LIBH3-DEV_PACKAGE_DEPENDS "libh3 (= ${H3_VERSION})")
|
719
|
+
set(CPACK_DEBIAN_H3_PACKAGE_DEPENDS "libc6 (>= 2.27), libh3 (= ${H3_VERSION})")
|
720
|
+
set(CPACK_DEBIAN_LIBH3_DESCRIPTION "Library files for the H3 hexagonal discrete global grid system.")
|
721
|
+
set(CPACK_DEBIAN_LIBH3-DEV_DESCRIPTION "Development files and headers for the H3 hexagonal discrete global grid system.")
|
722
|
+
set(CPACK_DEBIAN_H3_DESCRIPTION "UNIX style filter (command line) tools for the H3 hexagonal discrete global grid system.")
|
723
|
+
set(CPACK_DEBIAN_LIBH3_PACKAGE_NAME "libh3")
|
724
|
+
set(CPACK_DEBIAN_LIBH3-DEV_PACKAGE_NAME "libh3-dev")
|
725
|
+
set(CPACK_DEBIAN_H3_PACKAGE_NAME "h3")
|
726
|
+
set(CPACK_DEBIAN_LIBH3_PACKAGE_SECTION "libs")
|
727
|
+
set(CPACK_DEBIAN_LIBH3-DEV_PACKAGE_SECTION "libdevel")
|
728
|
+
set(CPACK_DEBIAN_H3_PACKAGE_SECTION "science")
|
729
|
+
|
730
|
+
include(CPack)
|
data/ext/h3/src/CONTRIBUTING.md
CHANGED
@@ -9,7 +9,7 @@ Planned improvements and changes are listed on the [H3 Roadmap](https://github.c
|
|
9
9
|
* Please include tests that show the bug is fixed or feature works as intended.
|
10
10
|
* Please add a description of your change to the Unreleased section of the [changelog](./CHANGELOG.md).
|
11
11
|
* Please open issues to discuss large features or changes which would break compatibility, before submitting pull requests.
|
12
|
-
* Please keep H3 compatible with major C compilers, such as GCC, Clang, and MSVC.
|
12
|
+
* Please keep H3 compatible with major C compilers, such as GCC, Clang, and MSVC. We use clang-format-9 for source code formatting, if you have another version the CI job may error on formatting differences.
|
13
13
|
* Please keep code coverage of the core H3 library at 100%.
|
14
14
|
|
15
15
|
Before we can merge your changes, you must agree to the [Uber Contributor License Agreement](https://cla-assistant.io/uber/h3).
|
data/ext/h3/src/README.md
CHANGED
@@ -1,22 +1,27 @@
|
|
1
|
+
<img align="right" src="https://uber.github.io/img/h3Logo-color.svg" alt="H3 Logo" width="200">
|
2
|
+
|
1
3
|
# H3: A Hexagonal Hierarchical Geospatial Indexing System
|
2
4
|
|
3
|
-
[![
|
4
|
-
[![
|
5
|
+
[![test-linux](https://github.com/uber/h3/workflows/test-linux/badge.svg)](https://github.com/uber/h3/actions)
|
6
|
+
[![test-macos](https://github.com/uber/h3/workflows/test-macos/badge.svg)](https://github.com/uber/h3/actions)
|
7
|
+
[![test-windows](https://github.com/uber/h3/workflows/test-windows/badge.svg)](https://github.com/uber/h3/actions)
|
8
|
+
[![test-website](https://github.com/uber/h3/workflows/test-website/badge.svg)](https://github.com/uber/h3/actions)
|
5
9
|
[![Coverage Status](https://coveralls.io/repos/github/uber/h3/badge.svg?branch=master)](https://coveralls.io/github/uber/h3?branch=master)
|
6
10
|
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
|
7
11
|
|
8
12
|
H3 is a geospatial indexing system using a hexagonal grid that can be (approximately) subdivided into finer and finer hexagonal grids, combining the benefits of a hexagonal grid with [S2](https://code.google.com/archive/p/s2-geometry-library/)'s hierarchical subdivisions.
|
9
13
|
|
10
|
-
Documentation is available at [https://
|
14
|
+
Documentation is available at [https://h3geo.org/](https://h3geo.org/). Developer documentation in Markdown format is available under the [dev-docs](./dev-docs/) directory.
|
11
15
|
|
12
16
|
* Post **bug reports or feature requests** to the [GitHub Issues page](https://github.com/uber/h3/issues)
|
13
17
|
* Ask **questions** by posting to the [H3 tag on StackOverflow](https://stackoverflow.com/questions/tagged/h3)
|
18
|
+
* There is also an [H3 Slack workspace](https://join.slack.com/t/h3-core/shared_invite/zt-g6u5r1hf-W_~uVJmfeiWtMQuBGc1NNg)
|
14
19
|
|
15
20
|
## Installing
|
16
21
|
|
17
|
-
We recommend using prebuilt bindings if they are available for your programming language. Bindings for [Go](https://github.com/uber/h3-go), [Java](https://github.com/uber/h3-java), [JavaScript](https://github.com/uber/h3-js), [Python](https://github.com/uber/h3-py), and [others](https://
|
22
|
+
We recommend using prebuilt bindings if they are available for your programming language. Bindings for [Go](https://github.com/uber/h3-go), [Java](https://github.com/uber/h3-java), [JavaScript](https://github.com/uber/h3-js), [Python](https://github.com/uber/h3-py), and [others](https://h3geo.org/docs/community/bindings) are available.
|
18
23
|
|
19
|
-
On macOS, you can install H3 using brew
|
24
|
+
On macOS, you can install H3 using `brew`:
|
20
25
|
```
|
21
26
|
brew install h3
|
22
27
|
```
|
@@ -28,7 +33,7 @@ Still here? To build the H3 C library, you'll need a C compiler (tested with `gc
|
|
28
33
|
|
29
34
|
#### Install build-time dependencies
|
30
35
|
|
31
|
-
* Alpine
|
36
|
+
* Alpine
|
32
37
|
```
|
33
38
|
# Installing the bare build requirements
|
34
39
|
apk add cmake make gcc libtool musl-dev
|
@@ -43,7 +48,7 @@ sudo apt install cmake make gcc libtool
|
|
43
48
|
sudo apt install clang-format cmake-curses-gui lcov doxygen
|
44
49
|
```
|
45
50
|
|
46
|
-
* macOS (using brew)
|
51
|
+
* macOS (using `brew`)
|
47
52
|
|
48
53
|
First make sure you [have the developer tools installed](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/) and then
|
49
54
|
|
@@ -58,24 +63,71 @@ brew install clang-format lcov doxygen
|
|
58
63
|
|
59
64
|
You will need to install CMake and Visual Studio, including the Visual C++ compiler. For building on Windows, please follow the [Windows build instructions](dev-docs/build_windows.md).
|
60
65
|
|
66
|
+
* FreeBSD
|
67
|
+
|
68
|
+
```
|
69
|
+
# Installing the build requirements
|
70
|
+
sudo pkg install bash cmake gmake doxygen lcov
|
71
|
+
```
|
72
|
+
|
61
73
|
#### Compilation
|
62
74
|
|
63
|
-
From the repository you
|
75
|
+
From the repository root, you can compile H3 with:
|
64
76
|
|
65
77
|
```
|
66
|
-
|
78
|
+
mkdir build
|
79
|
+
cd build
|
80
|
+
cmake ..
|
67
81
|
make
|
68
82
|
```
|
69
83
|
|
84
|
+
All subsequent `make` commands should be run from within the `build` directory.
|
85
|
+
|
86
|
+
**Note**: There are several ways to build H3 with CMake; the method above is just one example that restricts all build artifacts to the `build` directory.
|
87
|
+
|
70
88
|
You can install system-wide with:
|
71
89
|
|
72
90
|
```
|
73
91
|
sudo make install
|
74
92
|
```
|
75
93
|
|
94
|
+
If using the method above, from the repository root, you can clean all build artifacts with:
|
95
|
+
|
96
|
+
```
|
97
|
+
rm -rf build
|
98
|
+
```
|
99
|
+
|
76
100
|
#### Testing
|
77
101
|
|
78
|
-
After making the project, you can test with `make test
|
102
|
+
After making the project, you can test with `make test`.
|
103
|
+
You can run a faster test suite that excludes the most expensive tests with `make test-fast`.
|
104
|
+
|
105
|
+
#### Coverage
|
106
|
+
|
107
|
+
You can generate a code coverage report if `lcov` is installed, and if the project was built with the `CMAKE_BUILD_TYPE=Debug` option.
|
108
|
+
For example, from a clean repository, you could run:
|
109
|
+
|
110
|
+
```
|
111
|
+
mkdir build
|
112
|
+
cd build
|
113
|
+
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
114
|
+
make
|
115
|
+
make coverage
|
116
|
+
```
|
117
|
+
|
118
|
+
You can then view a detailed HTML coverage report by opening `coverage/index.html` in your browser.
|
119
|
+
|
120
|
+
#### Benchmarks
|
121
|
+
|
122
|
+
You can run timing benchmarks by building with the `CMAKE_BUILD_TYPE=Release`, and running `make benchmarks`:
|
123
|
+
|
124
|
+
```
|
125
|
+
mkdir build
|
126
|
+
cd build
|
127
|
+
cmake -DCMAKE_BUILD_TYPE=Release ..
|
128
|
+
make
|
129
|
+
make benchmarks
|
130
|
+
```
|
79
131
|
|
80
132
|
#### Documentation
|
81
133
|
|
@@ -92,8 +144,7 @@ To build the documentation website, see the [website/](./website/) directory.
|
|
92
144
|
To get the H3 index for some location:
|
93
145
|
|
94
146
|
```
|
95
|
-
./bin/geoToH3 10
|
96
|
-
40.689167 -74.044444
|
147
|
+
./bin/geoToH3 --resolution 10 --latitude 40.689167 --longitude -74.044444
|
97
148
|
```
|
98
149
|
|
99
150
|
10 is the H3 resolution, between 0 (coarsest) and 15 (finest). The coordinates entered are the latitude and longitude, in degrees, you want the index for (these coordinates are the Statue of Liberty). You should get an H3 index as output, like `8a2a1072b59ffff`.
|
@@ -101,8 +152,7 @@ To get the H3 index for some location:
|
|
101
152
|
You can then take this index and get some information about it, for example:
|
102
153
|
|
103
154
|
```
|
104
|
-
./bin/h3ToGeoBoundary
|
105
|
-
8a2a1072b59ffff
|
155
|
+
./bin/h3ToGeoBoundary --index 8a2a1072b59ffff
|
106
156
|
```
|
107
157
|
|
108
158
|
This will produce the vertices of the hexagon at this location:
|
@@ -122,8 +172,7 @@ This will produce the vertices of the hexagon at this location:
|
|
122
172
|
You can get the center coordinate of the hexagon like so:
|
123
173
|
|
124
174
|
```
|
125
|
-
./bin/h3ToGeo
|
126
|
-
8a2a1072b59ffff
|
175
|
+
./bin/h3ToGeo --index 8a2a1072b59ffff
|
127
176
|
```
|
128
177
|
|
129
178
|
This will produce some coordinate:
|