h3 3.4.4 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/ext/h3/Makefile +1 -1
- data/ext/h3/src/.gitignore +2 -1
- data/ext/h3/src/CHANGELOG.md +9 -0
- data/ext/h3/src/CMakeLists.txt +72 -45
- data/ext/h3/src/RELEASE.md +2 -1
- data/ext/h3/src/VERSION +1 -1
- data/ext/h3/src/docs/api/hierarchy.md +2 -0
- data/ext/h3/src/docs/api/indexing.md +3 -1
- data/ext/h3/src/docs/api/inspection.md +20 -0
- data/ext/h3/src/docs/api/misc.md +2 -0
- data/ext/h3/src/docs/api/regions.md +2 -0
- data/ext/h3/src/docs/api/traversal.md +2 -0
- data/ext/h3/src/docs/api/uniedge.md +2 -0
- data/ext/h3/src/docs/community/bindings.md +4 -0
- data/ext/h3/src/docs/community/tutorials.md +12 -0
- data/ext/h3/src/scripts/update_version.sh +50 -0
- data/ext/h3/src/src/apps/applib/include/args.h +122 -0
- data/ext/h3/src/src/apps/applib/include/utility.h +5 -62
- data/ext/h3/src/src/apps/applib/lib/args.c +216 -0
- data/ext/h3/src/src/apps/applib/lib/utility.c +40 -206
- data/ext/h3/src/src/apps/filters/geoToH3.c +7 -9
- data/ext/h3/src/src/apps/filters/h3ToComponents.c +50 -47
- data/ext/h3/src/src/apps/filters/h3ToGeo.c +7 -30
- data/ext/h3/src/src/apps/filters/h3ToGeoBoundary.c +7 -27
- data/ext/h3/src/src/apps/filters/h3ToLocalIj.c +42 -25
- data/ext/h3/src/src/apps/filters/hexRange.c +43 -24
- data/ext/h3/src/src/apps/filters/kRing.c +4 -4
- data/ext/h3/src/src/apps/filters/localIjToH3.c +63 -21
- data/ext/h3/src/src/apps/miscapps/h3ToGeoBoundaryHier.c +68 -44
- data/ext/h3/src/src/apps/miscapps/h3ToGeoHier.c +68 -43
- data/ext/h3/src/src/apps/miscapps/h3ToHier.c +48 -37
- data/ext/h3/src/src/apps/testapps/mkRandGeo.c +32 -27
- data/ext/h3/src/src/apps/testapps/mkRandGeoBoundary.c +33 -28
- data/ext/h3/src/src/apps/testapps/testH3GetFaces.c +136 -0
- data/ext/h3/src/src/h3lib/include/faceijk.h +19 -7
- data/ext/h3/src/src/h3lib/include/h3api.h.in +12 -1
- data/ext/h3/src/src/h3lib/lib/algos.c +7 -2
- data/ext/h3/src/src/h3lib/lib/faceijk.c +135 -103
- data/ext/h3/src/src/h3lib/lib/h3Index.c +86 -5
- data/lib/h3/bindings/private.rb +1 -0
- data/lib/h3/inspection.rb +34 -0
- data/lib/h3/version.rb +1 -1
- data/spec/inspection_spec.rb +33 -1
- metadata +6 -2
@@ -17,7 +17,7 @@
|
|
17
17
|
* @brief stdin/stdout filter that converts from integer H3 indexes to
|
18
18
|
* k-rings
|
19
19
|
*
|
20
|
-
*
|
20
|
+
* See `kRing --help` for usage.
|
21
21
|
*
|
22
22
|
* The program reads H3 indexes from stdin until EOF and outputs
|
23
23
|
* the H3 indexes within k-ring `k` to stdout.
|
@@ -30,6 +30,7 @@
|
|
30
30
|
#include <stdbool.h>
|
31
31
|
#include <stdio.h>
|
32
32
|
#include <stdlib.h>
|
33
|
+
#include "args.h"
|
33
34
|
#include "h3api.h"
|
34
35
|
#include "utility.h"
|
35
36
|
|
@@ -58,8 +59,7 @@ int main(int argc, char* argv[]) {
|
|
58
59
|
int k = 0;
|
59
60
|
H3Index origin = 0;
|
60
61
|
|
61
|
-
Arg helpArg =
|
62
|
-
.helpText = "Show this help message."};
|
62
|
+
Arg helpArg = ARG_HELP;
|
63
63
|
Arg kArg = {.names = {"-k", NULL},
|
64
64
|
.required = true,
|
65
65
|
.scanFormat = "%d",
|
@@ -75,7 +75,7 @@ int main(int argc, char* argv[]) {
|
|
75
75
|
.valueName = "origin",
|
76
76
|
.value = &origin,
|
77
77
|
.helpText =
|
78
|
-
"Origin, or not specified to read origins from standard
|
78
|
+
"Origin, or not specified to read origins from standard input."};
|
79
79
|
|
80
80
|
Arg* args[] = {&helpArg, &kArg, &printDistancesArg, &originArg};
|
81
81
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
* @brief stdin/stdout filter that converts from local IJ coordinates to
|
18
18
|
* H3 indexes. This is experimental.
|
19
19
|
*
|
20
|
-
*
|
20
|
+
* See `localIjToH3 --help` for usage.
|
21
21
|
*
|
22
22
|
* The program reads IJ coordinates (in the format `i j` separated by newlines)
|
23
23
|
* from stdin and outputs the corresponding H3 indexes to stdout, until EOF is
|
@@ -33,6 +33,7 @@
|
|
33
33
|
#include <inttypes.h>
|
34
34
|
#include <stdio.h>
|
35
35
|
#include <stdlib.h>
|
36
|
+
#include "args.h"
|
36
37
|
#include "h3api.h"
|
37
38
|
#include "utility.h"
|
38
39
|
|
@@ -46,30 +47,71 @@ void doCell(const CoordIJ *ij, H3Index origin) {
|
|
46
47
|
}
|
47
48
|
|
48
49
|
int main(int argc, char *argv[]) {
|
49
|
-
|
50
|
-
|
51
|
-
fprintf(stderr, "usage: %s [origin]\n", argv[0]);
|
52
|
-
exit(1);
|
53
|
-
}
|
50
|
+
H3Index origin = 0;
|
51
|
+
CoordIJ ij = {0};
|
54
52
|
|
55
|
-
|
56
|
-
|
53
|
+
Arg helpArg = ARG_HELP;
|
54
|
+
Arg originArg = {
|
55
|
+
.names = {"-o", "--origin"},
|
56
|
+
.scanFormat = "%" PRIx64,
|
57
|
+
.valueName = "origin",
|
58
|
+
.value = &origin,
|
59
|
+
.required = true,
|
60
|
+
.helpText =
|
61
|
+
"Origin (anchoring index) for the local coordinate system."};
|
62
|
+
Arg iArg = {.names = {"-i", NULL},
|
63
|
+
.scanFormat = "%d",
|
64
|
+
.valueName = "i",
|
65
|
+
.value = &ij.i,
|
66
|
+
.helpText =
|
67
|
+
"I coordinate. If not specified \"i j\" pairs will be read "
|
68
|
+
"from standard input."};
|
69
|
+
Arg jArg = {.names = {"-j", NULL},
|
70
|
+
.scanFormat = "%d",
|
71
|
+
.valueName = "j",
|
72
|
+
.value = &ij.j,
|
73
|
+
.helpText = "J coordinate."};
|
57
74
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
else
|
66
|
-
error("reading IJ coordinates from stdin");
|
67
|
-
}
|
75
|
+
Arg *args[] = {&helpArg, &originArg, &iArg, &jArg};
|
76
|
+
const int numArgs = 4;
|
77
|
+
const char *helpText = "Converts local IJ coordinates to H3 indexes";
|
78
|
+
|
79
|
+
if (parseArgs(argc, argv, numArgs, args, &helpArg, helpText)) {
|
80
|
+
return helpArg.found ? 0 : 1;
|
81
|
+
}
|
68
82
|
|
69
|
-
|
70
|
-
|
71
|
-
|
83
|
+
if (!H3_EXPORT(h3IsValid)(origin)) {
|
84
|
+
printHelp(stderr, argv[0], helpText, numArgs, args,
|
85
|
+
"Origin is invalid.", NULL);
|
86
|
+
return 1;
|
87
|
+
}
|
72
88
|
|
89
|
+
if (iArg.found != jArg.found) {
|
90
|
+
// One is found but the other is not.
|
91
|
+
printHelp(stderr, argv[0], helpText, numArgs, args,
|
92
|
+
"I and J must both be specified.", NULL);
|
93
|
+
return 1;
|
94
|
+
}
|
95
|
+
|
96
|
+
if (iArg.found) {
|
73
97
|
doCell(&ij, origin);
|
98
|
+
} else {
|
99
|
+
// process the coordinates on stdin
|
100
|
+
char buff[BUFF_SIZE];
|
101
|
+
while (1) {
|
102
|
+
// get coordinates from stdin
|
103
|
+
if (!fgets(buff, BUFF_SIZE, stdin)) {
|
104
|
+
if (feof(stdin))
|
105
|
+
break;
|
106
|
+
else
|
107
|
+
error("reading IJ coordinates from stdin");
|
108
|
+
}
|
109
|
+
|
110
|
+
if (!sscanf(buff, "%d %d", &ij.i, &ij.j))
|
111
|
+
error(
|
112
|
+
"Parsing IJ coordinates. Expected `<integer> <integer>`.");
|
113
|
+
|
114
|
+
doCell(&ij, origin);
|
115
|
+
}
|
74
116
|
}
|
75
117
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright 2016-2017 Uber Technologies, Inc.
|
2
|
+
* Copyright 2016-2017, 2019 Uber Technologies, Inc.
|
3
3
|
*
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
* you may not use this file except in compliance with the License.
|
@@ -17,7 +17,7 @@
|
|
17
17
|
* @brief takes an H3 index and generates cell boundaries for all descendants
|
18
18
|
* at a specified resolution.
|
19
19
|
*
|
20
|
-
*
|
20
|
+
* See `h3ToGeoBoundaryHier` for usage.
|
21
21
|
*
|
22
22
|
* The program generates the cell boundaries in lat/lon coordinates for all
|
23
23
|
* hierarchical children of H3Index at the specified resolution. If the
|
@@ -27,21 +27,23 @@
|
|
27
27
|
* `resolution` should be a positive integer. The default is 0 (i.e., only the
|
28
28
|
* specified cell H3Index would be processed).
|
29
29
|
*
|
30
|
-
* `
|
31
|
-
*
|
30
|
+
* `--kml` indicates KML output format; if not specified plain text output is
|
31
|
+
* the default.
|
32
32
|
*
|
33
33
|
* Examples:
|
34
34
|
* ---------
|
35
35
|
*
|
36
|
-
* `h3ToGeoBoundaryHier 836e9bfffffffff`
|
36
|
+
* `h3ToGeoBoundaryHier --parent 836e9bfffffffff`
|
37
37
|
* - outputs the cell boundary in lat/lon for cell `836e9bfffffffff` as
|
38
38
|
* plain text
|
39
39
|
*
|
40
|
-
* `h3ToGeoBoundaryHier 820ceffffffffff 4
|
40
|
+
* `h3ToGeoBoundaryHier --parent 820ceffffffffff --resolution 4 --kml >
|
41
|
+
* cells.kml`
|
41
42
|
* - outputs the cell boundaries of all of the resolution 4 descendants
|
42
43
|
* of cell `820ceffffffffff` as a KML file (redirected to `cells.kml`).
|
43
44
|
*
|
44
|
-
* `h3ToGeoBoundaryHier 86283082fffffff 9
|
45
|
+
* `h3ToGeoBoundaryHier --parent 86283082fffffff --resolution 9 --kml >
|
46
|
+
* uber9cells.kml`
|
45
47
|
* - creates a KML file containing the cell boundaries of all of the
|
46
48
|
* resolution 9 hexagons covering Uber HQ and the surrounding region of
|
47
49
|
* San Francisco
|
@@ -51,14 +53,12 @@
|
|
51
53
|
#include <stdio.h>
|
52
54
|
#include <stdlib.h>
|
53
55
|
#include <string.h>
|
56
|
+
#include "args.h"
|
54
57
|
#include "baseCells.h"
|
55
|
-
#include "coordijk.h"
|
56
|
-
#include "geoCoord.h"
|
57
58
|
#include "h3Index.h"
|
58
59
|
#include "h3api.h"
|
59
60
|
#include "kml.h"
|
60
61
|
#include "utility.h"
|
61
|
-
#include "vec2d.h"
|
62
62
|
|
63
63
|
void doCell(H3Index h, int isKmlOut) {
|
64
64
|
GeoBoundary b;
|
@@ -94,55 +94,79 @@ void recursiveH3IndexToGeo(H3Index h, int res, int isKmlOut) {
|
|
94
94
|
}
|
95
95
|
}
|
96
96
|
|
97
|
-
int main(int argc, char*
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
97
|
+
int main(int argc, char *argv[]) {
|
98
|
+
int res;
|
99
|
+
H3Index parentIndex = 0;
|
100
|
+
|
101
|
+
Arg helpArg = ARG_HELP;
|
102
|
+
Arg resArg = {.names = {"-r", "--resolution"},
|
103
|
+
.scanFormat = "%d",
|
104
|
+
.valueName = "res",
|
105
|
+
.value = &res,
|
106
|
+
.helpText =
|
107
|
+
"Resolution, if less than the resolution of the parent "
|
108
|
+
"only the parent is printed. Default the resolution of "
|
109
|
+
"the parent."};
|
110
|
+
Arg parentArg = {
|
111
|
+
.names = {"-p", "--parent"},
|
112
|
+
.scanFormat = "%" PRIx64,
|
113
|
+
.valueName = "parent",
|
114
|
+
.value = &parentIndex,
|
115
|
+
.required = true,
|
116
|
+
.helpText = "Print cell boundaries descendent from this index."};
|
117
|
+
Arg kmlArg = ARG_KML;
|
118
|
+
DEFINE_KML_NAME_ARG(userKmlName, kmlNameArg);
|
119
|
+
DEFINE_KML_DESC_ARG(userKmlDesc, kmlDescArg);
|
120
|
+
|
121
|
+
Arg *args[] = {&helpArg, &resArg, &parentArg,
|
122
|
+
&kmlArg, &kmlNameArg, &kmlDescArg};
|
123
|
+
const int numArgs = 6;
|
124
|
+
const char *helpText = "Print cell boundaries for descendants of an index";
|
125
|
+
|
126
|
+
if (parseArgs(argc, argv, numArgs, args, &helpArg, helpText)) {
|
127
|
+
return helpArg.found ? 0 : 1;
|
102
128
|
}
|
103
129
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
error("invalid base cell number");
|
130
|
+
if (res > MAX_H3_RES) {
|
131
|
+
printHelp(stderr, argv[0], helpText, numArgs, args,
|
132
|
+
"Resolution exceeds maximum resolution.", NULL);
|
133
|
+
return 1;
|
109
134
|
}
|
110
135
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
136
|
+
if (!H3_EXPORT(h3IsValid)(parentIndex)) {
|
137
|
+
printHelp(stderr, argv[0], helpText, numArgs, args,
|
138
|
+
"Parent index is invalid.", NULL);
|
139
|
+
return 1;
|
140
|
+
}
|
116
141
|
|
117
|
-
|
118
|
-
error("specified resolution exceeds max resolution");
|
142
|
+
int rootRes = H3_GET_RESOLUTION(parentIndex);
|
119
143
|
|
120
|
-
|
121
|
-
|
122
|
-
|
144
|
+
if (kmlArg.found) {
|
145
|
+
char *kmlName;
|
146
|
+
if (kmlNameArg.found) {
|
147
|
+
kmlName = strdup(userKmlName);
|
148
|
+
} else {
|
149
|
+
kmlName = calloc(BUFF_SIZE, sizeof(char));
|
123
150
|
|
124
|
-
|
125
|
-
|
151
|
+
sprintf(kmlName, "Cell %" PRIx64 " Res %d", parentIndex,
|
152
|
+
((res <= rootRes) ? rootRes : res));
|
153
|
+
}
|
126
154
|
|
127
|
-
|
128
|
-
|
155
|
+
char *kmlDesc = "Generated by h3ToGeoBoundaryHier";
|
156
|
+
if (kmlDescArg.found) kmlDesc = userKmlDesc;
|
129
157
|
|
130
|
-
|
131
|
-
((res <= rootRes) ? rootRes : res));
|
158
|
+
kmlBoundaryHeader(kmlName, kmlDesc);
|
132
159
|
|
133
|
-
|
134
|
-
}
|
135
|
-
}
|
160
|
+
free(kmlName);
|
136
161
|
}
|
137
162
|
|
138
163
|
// generate the points
|
139
|
-
|
140
164
|
if (res <= rootRes) {
|
141
|
-
doCell(
|
165
|
+
doCell(parentIndex, kmlArg.found);
|
142
166
|
} else {
|
143
|
-
H3_SET_RESOLUTION(
|
144
|
-
recursiveH3IndexToGeo(
|
167
|
+
H3_SET_RESOLUTION(parentIndex, res);
|
168
|
+
recursiveH3IndexToGeo(parentIndex, rootRes + 1, kmlArg.found);
|
145
169
|
}
|
146
170
|
|
147
|
-
if (
|
171
|
+
if (kmlArg.found) kmlBoundaryFooter();
|
148
172
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright 2016-2017 Uber Technologies, Inc.
|
2
|
+
* Copyright 2016-2017, 2019 Uber Technologies, Inc.
|
3
3
|
*
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
* you may not use this file except in compliance with the License.
|
@@ -17,7 +17,7 @@
|
|
17
17
|
* @brief takes an H3 index and generates cell center points for descendants a
|
18
18
|
* specified resolution.
|
19
19
|
*
|
20
|
-
*
|
20
|
+
* See `h3ToGeoHier --help` for usage.
|
21
21
|
*
|
22
22
|
* The program generates the cell center points in lat/lon coordinates for all
|
23
23
|
* hierarchical children of H3Index at the specified resolution. If the
|
@@ -27,22 +27,23 @@
|
|
27
27
|
* `resolution` should be a positive integer. The default is 0 (i.e., only the
|
28
28
|
* specified cell H3Index would be processed).
|
29
29
|
*
|
30
|
-
* `
|
31
|
-
*
|
30
|
+
* `--kml` indicates KML output format; if not specified plain text output is
|
31
|
+
* the default.
|
32
32
|
*
|
33
33
|
* Examples:
|
34
34
|
* ---------
|
35
35
|
*
|
36
|
-
* `h3ToGeoHier 836e9bfffffffff`
|
36
|
+
* `h3ToGeoHier --parent 836e9bfffffffff`
|
37
37
|
* - outputs the cell center point in lat/lon for cell
|
38
38
|
* `836e9bfffffffff` as plain text
|
39
39
|
*
|
40
|
-
* `h3ToGeoHier 820ceffffffffff 4
|
40
|
+
* `h3ToGeoHier --parent 820ceffffffffff --resolution 4 --kml > pts.kml`
|
41
41
|
* - outputs the cell center points of all of the resolution 4
|
42
42
|
* descendants of cell `820ceffffffffff` as a KML file (redirected to
|
43
43
|
* `pts.kml`).
|
44
44
|
*
|
45
|
-
* `h3ToGeoHier 86283082fffffff 9
|
45
|
+
* `h3ToGeoHier --parent 86283082fffffff --resolution 9 --kml >
|
46
|
+
* uber9pts.kml`
|
46
47
|
* - creates a KML file containing the cell center points of all of the
|
47
48
|
* resolution 9 hexagons covering Uber HQ and the surrounding region of
|
48
49
|
* San Francisco.
|
@@ -52,14 +53,12 @@
|
|
52
53
|
#include <stdio.h>
|
53
54
|
#include <stdlib.h>
|
54
55
|
#include <string.h>
|
56
|
+
#include "args.h"
|
55
57
|
#include "baseCells.h"
|
56
|
-
#include "coordijk.h"
|
57
|
-
#include "geoCoord.h"
|
58
58
|
#include "h3Index.h"
|
59
59
|
#include "h3api.h"
|
60
60
|
#include "kml.h"
|
61
61
|
#include "utility.h"
|
62
|
-
#include "vec2d.h"
|
63
62
|
|
64
63
|
void doCell(H3Index h, int isKmlOut) {
|
65
64
|
GeoCoord g;
|
@@ -95,55 +94,81 @@ void recursiveH3IndexToGeo(H3Index h, int res, int isKmlOut) {
|
|
95
94
|
}
|
96
95
|
}
|
97
96
|
|
98
|
-
int main(int argc, char*
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
97
|
+
int main(int argc, char *argv[]) {
|
98
|
+
int res = 0;
|
99
|
+
H3Index parentIndex = 0;
|
100
|
+
|
101
|
+
Arg helpArg = ARG_HELP;
|
102
|
+
Arg resArg = {.names = {"-r", "--resolution"},
|
103
|
+
.scanFormat = "%d",
|
104
|
+
.valueName = "res",
|
105
|
+
.value = &res,
|
106
|
+
.helpText =
|
107
|
+
"Resolution, if less than the resolution of the parent "
|
108
|
+
"only the parent is printed. Default the resolution of "
|
109
|
+
"the parent."};
|
110
|
+
Arg parentArg = {
|
111
|
+
.names = {"-p", "--parent"},
|
112
|
+
.scanFormat = "%" PRIx64,
|
113
|
+
.valueName = "parent",
|
114
|
+
.value = &parentIndex,
|
115
|
+
.required = true,
|
116
|
+
.helpText = "Print cell centers descendent from this index."};
|
117
|
+
Arg kmlArg = ARG_KML;
|
118
|
+
DEFINE_KML_NAME_ARG(userKmlName, kmlNameArg);
|
119
|
+
DEFINE_KML_DESC_ARG(userKmlDesc, kmlDescArg);
|
120
|
+
|
121
|
+
Arg *args[] = {&helpArg, &resArg, &parentArg,
|
122
|
+
&kmlArg, &kmlNameArg, &kmlDescArg};
|
123
|
+
const int numArgs = 6;
|
124
|
+
const char *helpText =
|
125
|
+
"Print cell center points for descendants of an index";
|
126
|
+
|
127
|
+
if (parseArgs(argc, argv, numArgs, args, &helpArg, helpText)) {
|
128
|
+
return helpArg.found ? 0 : 1;
|
103
129
|
}
|
104
130
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
error("invalid base cell number");
|
131
|
+
if (res > MAX_H3_RES) {
|
132
|
+
printHelp(stderr, argv[0], helpText, numArgs, args,
|
133
|
+
"Resolution exceeds maximum resolution.", NULL);
|
134
|
+
return 1;
|
110
135
|
}
|
111
136
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
137
|
+
if (!H3_EXPORT(h3IsValid)(parentIndex)) {
|
138
|
+
printHelp(stderr, argv[0], helpText, numArgs, args,
|
139
|
+
"Parent index is invalid.", NULL);
|
140
|
+
return 1;
|
141
|
+
}
|
117
142
|
|
118
|
-
|
119
|
-
error("specified resolution exceeds max resolution");
|
143
|
+
int rootRes = H3_GET_RESOLUTION(parentIndex);
|
120
144
|
|
121
|
-
|
122
|
-
|
123
|
-
|
145
|
+
if (kmlArg.found) {
|
146
|
+
char *kmlName;
|
147
|
+
if (kmlNameArg.found) {
|
148
|
+
kmlName = strdup(userKmlName);
|
149
|
+
} else {
|
150
|
+
kmlName = calloc(BUFF_SIZE, sizeof(char));
|
124
151
|
|
125
|
-
|
126
|
-
|
152
|
+
sprintf(kmlName, "Cell %" PRIx64 " Res %d", parentIndex,
|
153
|
+
((res <= rootRes) ? rootRes : res));
|
154
|
+
}
|
127
155
|
|
128
|
-
|
129
|
-
|
156
|
+
char *kmlDesc = "Generated by h3ToGeoHier";
|
157
|
+
if (kmlDescArg.found) kmlDesc = userKmlDesc;
|
130
158
|
|
131
|
-
|
132
|
-
((res <= rootRes) ? rootRes : res));
|
159
|
+
kmlBoundaryHeader(kmlName, kmlDesc);
|
133
160
|
|
134
|
-
|
135
|
-
}
|
136
|
-
}
|
161
|
+
free(kmlName);
|
137
162
|
}
|
138
163
|
|
139
164
|
// generate the points
|
140
165
|
|
141
166
|
if (res <= rootRes) {
|
142
|
-
doCell(
|
167
|
+
doCell(parentIndex, kmlArg.found);
|
143
168
|
} else {
|
144
|
-
H3_SET_RESOLUTION(
|
145
|
-
recursiveH3IndexToGeo(
|
169
|
+
H3_SET_RESOLUTION(parentIndex, res);
|
170
|
+
recursiveH3IndexToGeo(parentIndex, rootRes + 1, kmlArg.found);
|
146
171
|
}
|
147
172
|
|
148
|
-
if (
|
173
|
+
if (kmlArg.found) kmlBoundaryFooter();
|
149
174
|
}
|