h3 3.4.0 → 3.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/ext/h3/src/.travis.yml +5 -0
- data/ext/h3/src/CHANGELOG.md +25 -0
- data/ext/h3/src/CMakeLists.txt +5 -8
- data/ext/h3/src/CONTRIBUTING.md +2 -0
- data/ext/h3/src/README.md +6 -2
- data/ext/h3/src/VERSION +1 -1
- data/ext/h3/src/appveyor.yml +6 -1
- data/ext/h3/src/docs/api/misc.md +16 -0
- data/ext/h3/src/docs/community/bindings.md +9 -0
- data/ext/h3/src/docs/community/tutorials.md +4 -0
- data/ext/h3/src/scripts/binding_functions.ps1 +1 -2
- data/ext/h3/src/scripts/binding_functions.sh +3 -2
- data/ext/h3/src/scripts/coverage.sh.in +3 -3
- data/ext/h3/src/src/apps/applib/include/utility.h +60 -0
- data/ext/h3/src/src/apps/applib/lib/utility.c +196 -2
- data/ext/h3/src/src/apps/benchmarks/benchmarkPolyfill.c +7 -4
- data/ext/h3/src/src/apps/filters/geoToH3.c +73 -27
- data/ext/h3/src/src/apps/filters/h3ToGeo.c +63 -47
- data/ext/h3/src/src/apps/filters/h3ToGeoBoundary.c +64 -48
- data/ext/h3/src/src/apps/filters/h3ToLocalIj.c +4 -5
- data/ext/h3/src/src/apps/filters/hexRange.c +0 -1
- data/ext/h3/src/src/apps/filters/kRing.c +60 -28
- data/ext/h3/src/src/apps/filters/localIjToH3.c +75 -0
- data/ext/h3/src/src/apps/miscapps/generateBaseCellNeighbors.c +2 -2
- data/ext/h3/src/src/apps/testapps/testBBox.c +18 -0
- data/ext/h3/src/src/apps/testapps/testCompact.c +41 -0
- data/ext/h3/src/src/apps/testapps/testCoordIj.c +0 -1
- data/ext/h3/src/src/apps/testapps/testCoordIjk.c +53 -0
- data/ext/h3/src/src/apps/testapps/testH3Api.c +20 -0
- data/ext/h3/src/src/apps/testapps/testH3Distance.c +5 -3
- data/ext/h3/src/src/apps/testapps/testH3Line.c +18 -6
- data/ext/h3/src/src/apps/testapps/testH3ToLocalIj.c +75 -3
- data/ext/h3/src/src/apps/testapps/testH3UniEdge.c +17 -11
- data/ext/h3/src/src/apps/testapps/testHexRanges.c +10 -0
- data/ext/h3/src/src/apps/testapps/testKRing.c +11 -7
- data/ext/h3/src/src/h3lib/lib/algos.c +2 -1
- data/ext/h3/src/src/h3lib/lib/geoCoord.c +10 -10
- data/ext/h3/src/src/h3lib/lib/h3Index.c +1 -2
- data/ext/h3/src/src/h3lib/lib/localij.c +32 -36
- data/lib/h3/version.rb +1 -1
- metadata +4 -7
- data/ext/h3/src/cmake/CheckAlloca.cmake +0 -33
- data/ext/h3/src/cmake/CheckVLA.cmake +0 -33
- data/ext/h3/src/cmake/alloca_test.c +0 -29
- data/ext/h3/src/cmake/vla_test.c +0 -26
- data/ext/h3/src/src/h3lib/include/stackAlloc.h +0 -64
@@ -16,7 +16,6 @@
|
|
16
16
|
#include "algos.h"
|
17
17
|
#include "benchmark.h"
|
18
18
|
#include "h3api.h"
|
19
|
-
#include "stackAlloc.h"
|
20
19
|
|
21
20
|
// Fixtures
|
22
21
|
GeoCoord sfVerts[] = {
|
@@ -120,23 +119,27 @@ southernGeofence.verts = southernVerts;
|
|
120
119
|
southernGeoPolygon.geofence = southernGeofence;
|
121
120
|
|
122
121
|
int numHexagons;
|
122
|
+
H3Index* hexagons;
|
123
123
|
|
124
124
|
BENCHMARK(polyfillSF, 500, {
|
125
125
|
numHexagons = H3_EXPORT(maxPolyfillSize)(&sfGeoPolygon, 9);
|
126
|
-
|
126
|
+
hexagons = calloc(numHexagons, sizeof(H3Index));
|
127
127
|
H3_EXPORT(polyfill)(&sfGeoPolygon, 9, hexagons);
|
128
|
+
free(hexagons);
|
128
129
|
});
|
129
130
|
|
130
131
|
BENCHMARK(polyfillAlameda, 500, {
|
131
132
|
numHexagons = H3_EXPORT(maxPolyfillSize)(&alamedaGeoPolygon, 9);
|
132
|
-
|
133
|
+
hexagons = calloc(numHexagons, sizeof(H3Index));
|
133
134
|
H3_EXPORT(polyfill)(&alamedaGeoPolygon, 9, hexagons);
|
135
|
+
free(hexagons);
|
134
136
|
});
|
135
137
|
|
136
138
|
BENCHMARK(polyfillSouthernExpansion, 10, {
|
137
139
|
numHexagons = H3_EXPORT(maxPolyfillSize)(&southernGeoPolygon, 9);
|
138
|
-
|
140
|
+
hexagons = calloc(numHexagons, sizeof(H3Index));
|
139
141
|
H3_EXPORT(polyfill)(&southernGeoPolygon, 9, hexagons);
|
142
|
+
free(hexagons);
|
140
143
|
});
|
141
144
|
|
142
145
|
END_BENCHMARKS();
|
@@ -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 stdin/stdout filter that converts from lat/lon coordinates to integer
|
18
18
|
* H3 indexes
|
19
19
|
*
|
20
|
-
* usage: `geoToH3 resolution`
|
20
|
+
* usage: `geoToH3 --resolution res [--latitude lat --longitude lon]`
|
21
21
|
*
|
22
22
|
* The program reads lat/lon pairs from stdin until EOF is encountered. For
|
23
23
|
* each lat/lon the program outputs to stdout the integer H3 index of the
|
@@ -34,40 +34,86 @@
|
|
34
34
|
|
35
35
|
#include <stdio.h>
|
36
36
|
#include <stdlib.h>
|
37
|
-
#include "coordijk.h"
|
38
37
|
#include "h3Index.h"
|
39
38
|
#include "utility.h"
|
40
39
|
|
40
|
+
/**
|
41
|
+
* Convert coordinates to cell and print it.
|
42
|
+
*
|
43
|
+
* @param lat Degrees latitude
|
44
|
+
* @param lon Degrees longitude
|
45
|
+
* @param res Resolution
|
46
|
+
*/
|
47
|
+
void doCoords(double lat, double lon, int res) {
|
48
|
+
GeoCoord g;
|
49
|
+
setGeoDegs(&g, lat, lon);
|
50
|
+
|
51
|
+
H3Index h = H3_EXPORT(geoToH3)(&g, res);
|
52
|
+
|
53
|
+
h3Println(h);
|
54
|
+
}
|
55
|
+
|
41
56
|
int main(int argc, char* argv[]) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
exit(1);
|
46
|
-
}
|
57
|
+
int res = 0;
|
58
|
+
double lat = 0;
|
59
|
+
double lon = 0;
|
47
60
|
|
48
|
-
|
49
|
-
|
61
|
+
Arg helpArg = {.names = {"-h", "--help"},
|
62
|
+
.helpText = "Show this help message."};
|
63
|
+
Arg resArg = {.names = {"-r", "--resolution"},
|
64
|
+
.required = true,
|
65
|
+
.scanFormat = "%d",
|
66
|
+
.valueName = "res",
|
67
|
+
.value = &res,
|
68
|
+
.helpText = "Resolution, 0-15 inclusive."};
|
69
|
+
Arg latArg = {.names = {"--lat", "--latitude"},
|
70
|
+
.scanFormat = "%lf",
|
71
|
+
.valueName = "lat",
|
72
|
+
.value = &lat,
|
73
|
+
.helpText =
|
74
|
+
"Latitude in degrees. If not specified, \"latitude "
|
75
|
+
"longitude\" pairs will be read from stdin."};
|
76
|
+
Arg lonArg = {.names = {"--lon", "--longitude"},
|
77
|
+
.scanFormat = "%lf",
|
78
|
+
.valueName = "lon",
|
79
|
+
.value = &lon,
|
80
|
+
.helpText = "Longitude in degrees."};
|
50
81
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
else
|
60
|
-
error("reading lat/lon");
|
61
|
-
}
|
82
|
+
Arg* args[] = {&helpArg, &resArg, &latArg, &lonArg};
|
83
|
+
|
84
|
+
const char* helpText =
|
85
|
+
"Convert degrees latitude/longitude coordinates to H3 indexes.";
|
86
|
+
|
87
|
+
if (parseArgs(argc, argv, 4, args, &helpArg, helpText)) {
|
88
|
+
return helpArg.found ? 0 : 1;
|
89
|
+
}
|
62
90
|
|
63
|
-
|
91
|
+
if (latArg.found != lonArg.found) {
|
92
|
+
// One is found but the other is not.
|
93
|
+
printHelp(stderr, argv[0], helpText, 4, args,
|
94
|
+
"Latitude and longitude must both be specified.", NULL);
|
95
|
+
return 1;
|
96
|
+
}
|
64
97
|
|
65
|
-
|
66
|
-
|
67
|
-
|
98
|
+
if (latArg.found) {
|
99
|
+
doCoords(lat, lon, res);
|
100
|
+
} else {
|
101
|
+
// process the lat/lon's on stdin
|
102
|
+
char buff[BUFF_SIZE];
|
103
|
+
while (1) {
|
104
|
+
// get a lat/lon from stdin
|
105
|
+
if (!fgets(buff, BUFF_SIZE, stdin)) {
|
106
|
+
if (feof(stdin))
|
107
|
+
break;
|
108
|
+
else
|
109
|
+
error("reading lat/lon");
|
110
|
+
}
|
68
111
|
|
69
|
-
|
112
|
+
if (sscanf(buff, "%lf %lf", &lat, &lon) != 2)
|
113
|
+
error("parsing lat/lon");
|
70
114
|
|
71
|
-
|
115
|
+
// convert to H3
|
116
|
+
doCoords(lat, lon, res);
|
117
|
+
}
|
72
118
|
}
|
73
119
|
}
|
@@ -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,20 +17,17 @@
|
|
17
17
|
* @brief stdin/stdout filter that converts from integer H3 indexes to lat/lon
|
18
18
|
* cell center point
|
19
19
|
*
|
20
|
-
* usage: `h3ToGeo [
|
20
|
+
* usage: `h3ToGeo [--index index] [--kml [--kml-name name] [--kml-description
|
21
|
+
* desc]]`
|
21
22
|
*
|
22
23
|
* The program reads H3 indexes from stdin and outputs the corresponding
|
23
24
|
* cell center points to stdout, until EOF is encountered. The H3 indexes
|
24
25
|
* should be in integer form.
|
25
26
|
*
|
26
|
-
* `
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
* when `outputMode` == 1). The default is "geo from H3".
|
31
|
-
*
|
32
|
-
* `kmlName` indicates the string for the desc tag in KML output (only used
|
33
|
-
* when `outputMode` == 1). The default is "generated by h3ToGeo".
|
27
|
+
* `--kml` causes KML output to be printed. `--kml-name` and
|
28
|
+
* `--kml-description` can be used to change the name and description in the
|
29
|
+
* KML header, which default to "H3 Geometry" and "Generated by h3ToGeo"
|
30
|
+
* respectively.
|
34
31
|
*
|
35
32
|
* Examples:
|
36
33
|
*
|
@@ -38,22 +35,19 @@
|
|
38
35
|
* - outputs plain text cell center points for the H3 indexes contained
|
39
36
|
* in the file `indexes.txt`
|
40
37
|
*
|
41
|
-
* `h3ToGeo
|
38
|
+
* `h3ToGeo --kml --kml-name "kml title" --kml-description "h3 cells" <
|
39
|
+
* indexes.txt > cells.kml`
|
42
40
|
* - creates the KML file `cells.kml` containing the cell center points
|
43
41
|
* for all of the H3 indexes contained in the file `indexes.txt`.
|
44
42
|
*/
|
45
43
|
|
44
|
+
#include <inttypes.h>
|
46
45
|
#include <stdio.h>
|
47
46
|
#include <stdlib.h>
|
48
47
|
#include <string.h>
|
49
|
-
#include "baseCells.h"
|
50
|
-
#include "coordijk.h"
|
51
|
-
#include "geoCoord.h"
|
52
|
-
#include "h3Index.h"
|
53
48
|
#include "h3api.h"
|
54
49
|
#include "kml.h"
|
55
50
|
#include "utility.h"
|
56
|
-
#include "vec2d.h"
|
57
51
|
|
58
52
|
void doCell(H3Index h, int isKmlOut) {
|
59
53
|
GeoCoord g;
|
@@ -72,46 +66,68 @@ void doCell(H3Index h, int isKmlOut) {
|
|
72
66
|
}
|
73
67
|
|
74
68
|
int main(int argc, char *argv[]) {
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
exit(1);
|
79
|
-
}
|
69
|
+
H3Index index = 0;
|
70
|
+
char userKmlName[BUFF_SIZE] = {0};
|
71
|
+
char userKmlDesc[BUFF_SIZE] = {0};
|
80
72
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
73
|
+
Arg helpArg = {.names = {"-h", "--help"},
|
74
|
+
.helpText = "Show this help message."};
|
75
|
+
Arg indexArg = {
|
76
|
+
.names = {"-i", "--index"},
|
77
|
+
.scanFormat = "%" PRIx64,
|
78
|
+
.valueName = "index",
|
79
|
+
.value = &index,
|
80
|
+
.helpText =
|
81
|
+
"Index, or not specified to read indexes from standard in."};
|
82
|
+
Arg kmlArg = {.names = {"-k", "--kml"},
|
83
|
+
.helpText = "Print output in KML format."};
|
84
|
+
Arg kmlNameArg = {.names = {"--kn", "--kml-name"},
|
85
|
+
.scanFormat = "%255c", // BUFF_SIZE - 1
|
86
|
+
.valueName = "name",
|
87
|
+
.value = &userKmlName,
|
88
|
+
.helpText = "Text for the KML name tag."};
|
89
|
+
Arg kmlDescArg = {.names = {"--kd", "--kml-description"},
|
90
|
+
.scanFormat = "%255c", // BUFF_SIZE - 1
|
91
|
+
.valueName = "description",
|
92
|
+
.value = &userKmlDesc,
|
93
|
+
.helpText = "Text for the KML description tag."};
|
85
94
|
|
86
|
-
|
87
|
-
char *defaultKmlName = "geo from H3";
|
88
|
-
char *defaultKmlDesc = "from h3ToGeo";
|
95
|
+
Arg *args[] = {&helpArg, &indexArg, &kmlArg, &kmlNameArg, &kmlDescArg};
|
89
96
|
|
90
|
-
|
91
|
-
|
97
|
+
if (parseArgs(argc, argv, 5, args, &helpArg,
|
98
|
+
"Converts indexes to latitude/longitude center coordinates "
|
99
|
+
"in degrees")) {
|
100
|
+
return helpArg.found ? 0 : 1;
|
101
|
+
}
|
92
102
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
103
|
+
if (kmlArg.found) {
|
104
|
+
char *kmlName = "H3 Geometry";
|
105
|
+
if (kmlNameArg.found) kmlName = userKmlName;
|
106
|
+
|
107
|
+
char *kmlDesc = "Generated by h3ToGeo";
|
108
|
+
if (kmlDescArg.found) kmlDesc = userKmlDesc;
|
97
109
|
|
98
110
|
kmlPtsHeader(kmlName, kmlDesc);
|
99
111
|
}
|
100
112
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
//
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
113
|
+
if (indexArg.found) {
|
114
|
+
doCell(index, kmlArg.found);
|
115
|
+
} else {
|
116
|
+
// process the indexes on stdin
|
117
|
+
char buff[BUFF_SIZE];
|
118
|
+
while (1) {
|
119
|
+
// get an index from stdin
|
120
|
+
if (!fgets(buff, BUFF_SIZE, stdin)) {
|
121
|
+
if (feof(stdin))
|
122
|
+
break;
|
123
|
+
else
|
124
|
+
error("reading H3 index from stdin");
|
125
|
+
}
|
111
126
|
|
112
|
-
|
113
|
-
|
127
|
+
H3Index h3 = H3_EXPORT(stringToH3)(buff);
|
128
|
+
doCell(h3, kmlArg.found);
|
129
|
+
}
|
114
130
|
}
|
115
131
|
|
116
|
-
if (
|
132
|
+
if (kmlArg.found) kmlPtsFooter();
|
117
133
|
}
|
@@ -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,19 +17,16 @@
|
|
17
17
|
* @brief stdin/stdout filter that converts from integer H3 indexes to lat/lon
|
18
18
|
* cell boundaries
|
19
19
|
*
|
20
|
-
* usage: `h3ToGeoBoundary [
|
20
|
+
* usage: `h3ToGeoBoundary [--index index] [--kml [--kml-name name]
|
21
|
+
* [--kml-description desc]]`
|
21
22
|
*
|
22
23
|
* The program reads H3 indexes from stdin and outputs the corresponding
|
23
24
|
* cell boundaries to stdout, until EOF is encountered.
|
24
25
|
*
|
25
|
-
* `
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
29
|
-
* when `outputMode` == 1). The default is "geo from H3".
|
30
|
-
*
|
31
|
-
* `kmlName` indicates the string for the desc tag in KML output (only used
|
32
|
-
* when `outputMode` == 1). The default is "generated by h3ToGeoBoundary".
|
26
|
+
* `--kml` causes KML output to be printed. `--kml-name` and
|
27
|
+
* `--kml-description` can be used to change the name and description in the
|
28
|
+
* KML header, which default to "H3 Geometry" and "Generated by
|
29
|
+
* h3ToGeoBoundary" respectively.
|
33
30
|
*
|
34
31
|
* Examples:
|
35
32
|
*
|
@@ -37,22 +34,19 @@
|
|
37
34
|
* - outputs plain text cell boundaries for the H3 indexes contained
|
38
35
|
* in the file `indexes.txt`
|
39
36
|
*
|
40
|
-
* `h3ToGeoBoundary
|
37
|
+
* `h3ToGeoBoundary --kml --kml-name "kml title" --kml-description "h3
|
38
|
+
* cells" < indexes.txt > cells.kml`
|
41
39
|
* - creates the KML file `cells.kml` containing the cell boundaries for
|
42
|
-
*
|
40
|
+
* all of the H3 indexes contained in the file `indexes.txt`.
|
43
41
|
*/
|
44
42
|
|
43
|
+
#include <inttypes.h>
|
45
44
|
#include <stdio.h>
|
46
45
|
#include <stdlib.h>
|
47
46
|
#include <string.h>
|
48
|
-
#include "baseCells.h"
|
49
|
-
#include "coordijk.h"
|
50
|
-
#include "geoCoord.h"
|
51
|
-
#include "h3Index.h"
|
52
47
|
#include "h3api.h"
|
53
48
|
#include "kml.h"
|
54
49
|
#include "utility.h"
|
55
|
-
#include "vec2d.h"
|
56
50
|
|
57
51
|
void doCell(H3Index h, int isKmlOut) {
|
58
52
|
GeoBoundary b;
|
@@ -70,46 +64,68 @@ void doCell(H3Index h, int isKmlOut) {
|
|
70
64
|
}
|
71
65
|
|
72
66
|
int main(int argc, char *argv[]) {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
exit(1);
|
77
|
-
}
|
67
|
+
H3Index index = 0;
|
68
|
+
char userKmlName[BUFF_SIZE] = {0};
|
69
|
+
char userKmlDesc[BUFF_SIZE] = {0};
|
78
70
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
71
|
+
Arg helpArg = {.names = {"-h", "--help"},
|
72
|
+
.helpText = "Show this help message."};
|
73
|
+
Arg indexArg = {
|
74
|
+
.names = {"-i", "--index"},
|
75
|
+
.scanFormat = "%" PRIx64,
|
76
|
+
.valueName = "index",
|
77
|
+
.value = &index,
|
78
|
+
.helpText =
|
79
|
+
"Index, or not specified to read indexes from standard in."};
|
80
|
+
Arg kmlArg = {.names = {"-k", "--kml"},
|
81
|
+
.helpText = "Print output in KML format."};
|
82
|
+
Arg kmlNameArg = {.names = {"--kn", "--kml-name"},
|
83
|
+
.scanFormat = "%255c", // BUFF_SIZE - 1
|
84
|
+
.valueName = "name",
|
85
|
+
.value = &userKmlName,
|
86
|
+
.helpText = "Text for the KML name tag."};
|
87
|
+
Arg kmlDescArg = {.names = {"--kd", "--kml-description"},
|
88
|
+
.scanFormat = "%255c", // BUFF_SIZE - 1
|
89
|
+
.valueName = "description",
|
90
|
+
.value = &userKmlDesc,
|
91
|
+
.helpText = "Text for the KML description tag."};
|
83
92
|
|
84
|
-
|
85
|
-
char *defaultKmlName = "geo from H3";
|
86
|
-
char *defaultKmlDesc = "from h3ToGeo";
|
93
|
+
Arg *args[] = {&helpArg, &indexArg, &kmlArg, &kmlNameArg, &kmlDescArg};
|
87
94
|
|
88
|
-
|
89
|
-
|
95
|
+
if (parseArgs(argc, argv, 5, args, &helpArg,
|
96
|
+
"Converts indexes to latitude/longitude cell boundaries in "
|
97
|
+
"degrees")) {
|
98
|
+
return helpArg.found ? 0 : 1;
|
99
|
+
}
|
90
100
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
101
|
+
if (kmlArg.found) {
|
102
|
+
char *kmlName = "H3 Geometry";
|
103
|
+
if (kmlNameArg.found) kmlName = userKmlName;
|
104
|
+
|
105
|
+
char *kmlDesc = "Generated by h3ToGeoBoundary";
|
106
|
+
if (kmlDescArg.found) kmlDesc = userKmlDesc;
|
95
107
|
|
96
108
|
kmlPtsHeader(kmlName, kmlDesc);
|
97
109
|
}
|
98
110
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
//
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
111
|
+
if (indexArg.found) {
|
112
|
+
doCell(index, kmlArg.found);
|
113
|
+
} else {
|
114
|
+
// process the indexes on stdin
|
115
|
+
char buff[BUFF_SIZE];
|
116
|
+
while (1) {
|
117
|
+
// get an index from stdin
|
118
|
+
if (!fgets(buff, BUFF_SIZE, stdin)) {
|
119
|
+
if (feof(stdin))
|
120
|
+
break;
|
121
|
+
else
|
122
|
+
error("reading H3 index from stdin");
|
123
|
+
}
|
109
124
|
|
110
|
-
|
111
|
-
|
125
|
+
H3Index h3 = H3_EXPORT(stringToH3)(buff);
|
126
|
+
doCell(h3, kmlArg.found);
|
127
|
+
}
|
112
128
|
}
|
113
129
|
|
114
|
-
if (
|
130
|
+
if (kmlArg.found) kmlPtsFooter();
|
115
131
|
}
|