Compare commits

..
Author SHA1 Message Date
Erica Fischer 3456fa75ed Implement and test attribute prefix stripping in overzoom 2024-09-19 13:02:56 -07:00
Erica Fischer 5ec93a12b8 Plumbing for exclude and exclude-prefix 2024-09-19 12:39:30 -07:00
Erica Fischer 5e95095284 Test behavior of prefixed attributes 2024-09-19 09:49:38 -07:00
Erica Fischer 100828f019 Attrs with the accumulation prefix are just preserved, not accumulated 2024-09-19 09:42:31 -07:00
Erica Fischer 6f12453100 Factor out numeric preservation 2024-09-19 09:30:03 -07:00
Erica Fischer 0299706c47 Mark unexercised attribute accumulation cases as "can't happen" 2024-09-19 09:00:24 -07:00
Erica Fischer e60ca59502 Fix neglected --accumulate-attribute when binning 2024-09-18 14:35:39 -07:00
Erica Fischer d3dfe7f45d More testing to make sure cluster sizes make it all the way through 2024-09-18 12:36:38 -07:00
Erica Fischer 1f9be23aba Forgot to update this test 2024-09-18 10:49:20 -07:00
Erica Fischer 4ff265912d Make sure the accumulate test still works with a different prefix 2024-09-18 10:40:51 -07:00
Erica Fischer 59026112f6 Make the numeric accumulation prefix configurable 2024-09-18 10:36:09 -07:00
Erica Fischer 21bf44720d Fix count/mean accumulation 2024-09-17 22:15:17 -07:00
Erica Fischer 172f7382b5 Merge remote-tracking branch 'origin/main' into more-attribute-accumulation 2024-09-17 17:26:39 -07:00
Erica Fischer 19c144761b Make sure IDs make it through on the bins 2024-09-17 17:23:54 -07:00
Erica Fischer aa3ef1fbbf Add binning tests 2024-09-17 17:21:59 -07:00
Erica Fischer 060e2ee1c1 Fix a typo that broke accumulation 2024-09-17 15:16:31 -07:00
Erica Fischer 64b4a820c2 Found a flaw, now to debug 2024-09-17 14:16:58 -07:00
Erica Fischer 9a8c8df007 Checkpoint before I break everything 2024-09-17 14:04:02 -07:00
Erica Fischer 27a4f4ecef Handle aggregated attributes with no base attribute in the feature 2024-09-16 17:03:05 -07:00
Erica Fischer a2adb60638 Add means, but somehow I have some counts of 0 2024-09-13 12:39:53 -07:00
Erica Fischer 7a0878da9b Fix backwards conditional 2024-09-13 11:32:51 -07:00
Erica Fischer 56655e6ebf Use the same attribute accumulation logic in binning as in megatiles 2024-09-13 11:11:56 -07:00
Erica Fischer e2cc71b42f Put all that behind an --accumulate-numeric flag 2024-09-12 16:10:24 -07:00
Erica Fischer 9739f342e6 Actually do some accumulation 2024-09-12 15:33:14 -07:00
Erica Fischer 50bf0dc3be More sketching 2024-09-12 14:42:21 -07:00
Erica Fischer 88f8b95f27 More sketching 2024-09-12 14:02:39 -07:00
Erica Fischer b234cb9dac Some sort of test for how all these things interact with each other.
Automatic numeric attribute accumulation does *not* apply to attributes
that have an explicit attribute accumulator set, because the order of
operations is too messy and weird
2024-09-12 11:36:16 -07:00
Erica Fischer becfac9da9 Inching toward attribute accumulation in megatile handling 2024-09-12 11:08:21 -07:00
Erica Fischer 78b4fc19ec Quick bbox reject for bins that can't possibly intersect 2024-09-12 10:08:28 -07:00
Erica Fischer 3e3e7a5e4d Plumb bounding boxes through potential intersections 2024-09-12 09:57:39 -07:00
4 changed files with 9 additions and 44 deletions
-6
View File
@@ -1,9 +1,3 @@
# 2.62.3
* Summary statistics with --accumulate-numeric-attributes make it from tiling through to binning
* Prefix can be specified for --accumulate-numeric-attributes
* Added --exclude and --exclude-prefix to tippecanoe-overzoom
# 2.62.2
* Pass feature ID through with bins
-2
View File
@@ -159,11 +159,9 @@ void preserve_attribute(attribute_op const &op, std::string const &key, serial_v
s.count = 2;
attribute_accum_state.insert(std::pair<std::string, accum_state>(key, s));
full_values[i].type = mvt_double;
full_values[i].s = std::to_string(s.count);
} else { // already present, incrementing
state->second.count += 1;
full_values[i].type = mvt_double;
full_values[i].s = std::to_string(state->second.count);
}
return;
+8 -35
View File
@@ -1186,18 +1186,13 @@ static void preserve_numeric(const std::string &key, const mvt_value &val, /
// it is the wrong one.
std::string outkey = key;
bool starting_from_accumulation;
if (starts_with(outkey, accumulate_numeric + ":")) {
std::string prefix = accumulate_numeric + ":" + op.first + ":";
if (starts_with(outkey, prefix)) {
outkey = outkey.substr(prefix.size());
starting_from_accumulation = true; // from a subaccumulation
} else {
continue; // to next operation
}
} else {
starting_from_accumulation = false; // from a plain value
}
// and then put it back on for the output field
std::string prefixed = accumulate_numeric + ":" + op.first + ":" + outkey;
@@ -1213,18 +1208,11 @@ static void preserve_numeric(const std::string &key, const mvt_value &val, /
// not present at all, so copy our value to the prefixed output
numeric_out_field.emplace(prefixed, full_keys.size());
full_keys.push_back(prefixed);
if (op.second == op_count) {
if (starting_from_accumulation) {
// copy our count
full_values.push_back(mvt_value_to_serial_val(val));
} else {
// new count of 1
serial_val sv;
sv.type = mvt_double;
sv.s = "1";
full_values.push_back(sv);
}
serial_val sv;
sv.type = mvt_double;
sv.s = "1";
full_values.push_back(sv);
} else {
full_values.push_back(mvt_value_to_serial_val(val));
}
@@ -1232,35 +1220,20 @@ static void preserve_numeric(const std::string &key, const mvt_value &val, /
// exists unprefixed, so copy it, and then accumulate on our value
numeric_out_field.emplace(prefixed, full_keys.size());
full_keys.push_back(prefixed);
if (op.second == op_count) {
serial_val sv;
sv.type = mvt_double;
if (starting_from_accumulation) {
// sum our count onto the existing 1
sv.s = std::to_string(1 + mvt_value_to_long_long(val));
} else {
// sum our 1 onto the existing 1
sv.s = "2";
}
sv.s = "1";
full_values.push_back(sv);
} else {
full_values.push_back(full_values[out_attr->second]);
preserve_attribute(op.second, prefixed, mvt_value_to_serial_val(val), full_keys, full_values, attribute_accum_state);
}
preserve_attribute(op.second, prefixed, mvt_value_to_serial_val(val), full_keys, full_values, attribute_accum_state);
}
} else {
// exists, so accumulate on our value
if (op.second == op_count) {
if (starting_from_accumulation) {
// sum our count onto the existing count
full_values[prefixed_attr->second].s = std::to_string(atoll(full_values[prefixed_attr->second].s.c_str()) + mvt_value_to_long_long(val));
} else {
full_values[prefixed_attr->second].s = std::to_string(atoll(full_values[prefixed_attr->second].s.c_str()) + 1);
}
} else {
preserve_attribute(op.second, prefixed, mvt_value_to_serial_val(val), full_keys, full_values, attribute_accum_state);
}
preserve_attribute(op.second, prefixed, mvt_value_to_serial_val(val), full_keys, full_values, attribute_accum_state);
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.62.3"
#define VERSION "v2.62.2"
#endif