Add Hilbert Curve feature sequencing as an option

This commit is contained in:
Eric Fischer
2018-12-12 10:51:00 -08:00
parent 5f1c0e151f
commit 6376c283ba
10 changed files with 9842 additions and 20 deletions
+11 -2
View File
@@ -269,7 +269,7 @@ struct drop_state {
int calc_feature_minzoom(struct index *ix, struct drop_state *ds, int maxzoom, double gamma) {
int feature_minzoom = 0;
unsigned xx, yy;
decode(ix->ix, &xx, &yy);
decode_index(ix->ix, &xx, &yy);
if (gamma >= 0 && (ix->t == VT_POINT ||
(additional[A_LINE_DROP] && ix->t == VT_LINE) ||
@@ -2062,7 +2062,7 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
long long ip;
for (ip = 0; ip < indices; ip++) {
unsigned xx, yy;
decode(map[ip].ix, &xx, &yy);
decode_index(map[ip].ix, &xx, &yy);
long long nprogress = 100 * ip / indices;
if (nprogress != progress) {
@@ -2590,6 +2590,7 @@ int main(int argc, char **argv) {
{"reorder", no_argument, &additional[A_REORDER], 1},
{"coalesce", no_argument, &additional[A_COALESCE], 1},
{"reverse", no_argument, &additional[A_REVERSE], 1},
{"hilbert", no_argument, &additional[A_HILBERT], 1},
{"Adding calculated attributes", 0, 0, 0},
{"calculate-feature-density", no_argument, &additional[A_CALCULATE_FEATURE_DENSITY], 1},
@@ -3022,6 +3023,14 @@ int main(int argc, char **argv) {
}
}
if (additional[A_HILBERT]) {
encode_index = encode_hilbert;
decode_index = decode_hilbert;
} else {
encode_index = encode_quadkey;
decode_index = decode_quadkey;
}
// Wait until here to project the bounding box, so that the behavior is
// the same no matter what order the projection and bounding box are
// specified in