Compare commits

...
Author SHA1 Message Date
Erica Fischer 1eb498604a Oh, I didn't git add the code changes 2024-10-11 12:42:01 -07:00
Erica Fischer fa884700d1 Fix multiplier density threshold, I think 2024-10-11 12:27:58 -07:00
Erica Fischer e191570d53 Track two kinds of previous index for next_feature 2024-10-11 12:17:10 -07:00
Erica Fischer b1466547f3 Revert "Revert "The multiplier cap was a bad idea""
This reverts commit 80f7cb1c0e.
2024-10-11 11:51:28 -07:00
Erica Fischer 9d4a2f7d29 Revert "Revert "Limit feature expansion from multiplier density to 2x""
This reverts commit 44a683d808.
2024-10-11 11:51:22 -07:00
Erica Fischer 20db5c53de Revert "Revert "Add a flag to retain multiplier features by minimum distance""
This reverts commit 776da4a1b8.
2024-10-11 11:51:15 -07:00
Erica Fischer b9b55db535 Remove the multiplier sequence, which should no longer matter 2024-10-10 13:25:37 -07:00
Erica Fischer 776da4a1b8 Revert "Add a flag to retain multiplier features by minimum distance"
This reverts commit 01f14a4255.
2024-10-10 13:20:04 -07:00
Erica Fischer 44a683d808 Revert "Limit feature expansion from multiplier density to 2x"
This reverts commit a26e41309d.
2024-10-10 13:19:54 -07:00
Erica Fischer 80f7cb1c0e Revert "The multiplier cap was a bad idea"
This reverts commit 6f8273a4c8.
2024-10-10 13:19:48 -07:00
Erica Fischer 6f8273a4c8 The multiplier cap was a bad idea 2024-10-09 12:27:33 -07:00
Erica Fischer a26e41309d Limit feature expansion from multiplier density to 2x 2024-10-09 10:33:42 -07:00
Erica Fischer 01f14a4255 Add a flag to retain multiplier features by minimum distance 2024-10-08 16:34:08 -07:00
7 changed files with 30959 additions and 123 deletions
+4
View File
@@ -93,6 +93,7 @@ size_t limit_tile_feature_count_at_maxzoom = 0;
unsigned int drop_denser = 0;
std::map<std::string, serial_val> set_attributes;
unsigned long long preserve_point_density_threshold = 0;
unsigned long long preserve_multiplier_density_threshold = 0;
long long extend_zooms_max = 0;
int retain_points_multiplier = 1;
std::vector<std::string> unidecode_data;
@@ -3109,6 +3110,7 @@ int main(int argc, char **argv) {
{"cluster-distance", required_argument, 0, 'K'},
{"cluster-maxzoom", required_argument, 0, 'k'},
{"preserve-point-density-threshold", required_argument, 0, '~'},
{"preserve-multiplier-density-threshold", required_argument, 0, '~'},
{"Dropping or merging a fraction of features to keep under tile size limits", 0, 0, 0},
{"drop-densest-as-needed", no_argument, &additional[A_DROP_DENSEST_AS_NEEDED], 1},
@@ -3320,6 +3322,8 @@ int main(int argc, char **argv) {
}
} else if (strcmp(opt, "preserve-point-density-threshold") == 0) {
preserve_point_density_threshold = atoll_require(optarg, "Preserve point density threshold");
} else if (strcmp(opt, "preserve-multiplier-density-threshold") == 0) {
preserve_multiplier_density_threshold = atoll_require(optarg, "Preserve multiplier density threshold");
} else if (strcmp(opt, "extend-zooms-if-still-dropping-maximum") == 0) {
extend_zooms_max = atoll_require(optarg, "Maximum number by which to extend zooms");
} else if (strcmp(opt, "retain-points-multiplier") == 0) {
+1
View File
@@ -65,6 +65,7 @@ extern long long extend_zooms_max;
extern int retain_points_multiplier;
extern size_t maximum_string_attribute_length;
extern std::string accumulate_numeric;
extern unsigned long long preserve_multiplier_density_threshold;
struct order_field {
std::string name;
+1
View File
@@ -744,6 +744,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf, std::
additional[A_GENERATE_POLYGON_LABEL_POINTS] ||
sst->uses_gamma ||
retain_points_multiplier > 1 ||
preserve_multiplier_density_threshold > 0 ||
cluster_distance != 0) {
sf.index = bbox_index;
} else {
+2
View File
@@ -94,9 +94,11 @@ struct serial_feature {
#define FEATURE_DROPPED -1
#define FEATURE_KEPT 0
#define FEATURE_ADDED_FOR_MULTIPLIER_DENSITY INT_MAX
// <0: dropped
// 0: kept
// >0: sequence number of additional feature kept by retain-points-multiplier
// INT_MAX: additional feature kept by preserve-multiplier-density-threshold
int dropped = FEATURE_DROPPED; // was this feature dropped by rate?
// unsigned long long drop_by; // dot-dropping priority
@@ -9,7 +9,7 @@
"maxzoom": "10",
"minzoom": "0",
"name": "tests/muni/out/-z10_--retain-points-multiplier_10_-M10000_--drop-smallest-as-needed.json.check.mbtiles",
"strategies": "[{\"dropped_by_rate\":4606},{\"dropped_by_rate\":4600},{\"dropped_by_rate\":4580},{\"dropped_by_rate\":4538},{\"dropped_by_rate\":4437},{\"dropped_by_rate\":4161},{\"dropped_by_rate\":3498},{\"dropped_by_rate\":1846},{\"dropped_by_rate\":1066,\"dropped_as_needed\":311,\"tile_size_desired\":68538},{\"dropped_by_rate\":1058,\"dropped_as_needed\":1579,\"tile_size_desired\":72665},{\"dropped_as_needed\":4452,\"tile_size_desired\":67958}]",
"strategies": "[{\"dropped_by_rate\":4606},{\"dropped_by_rate\":4600},{\"dropped_by_rate\":4580},{\"dropped_by_rate\":4538},{\"dropped_by_rate\":4437},{\"dropped_by_rate\":4161},{\"dropped_by_rate\":3498},{\"dropped_by_rate\":1846},{\"dropped_by_rate\":1068,\"dropped_as_needed\":314,\"tile_size_desired\":68538},{\"dropped_by_rate\":1061,\"dropped_as_needed\":1591,\"tile_size_desired\":72665},{\"dropped_as_needed\":4481,\"tile_size_desired\":67958}]",
"tippecanoe_decisions": "{\"basezoom\":10,\"droprate\":2.5,\"retain_points_multiplier\":10}",
"type": "overlay",
"version": "2"
@@ -18950,7 +18950,7 @@
,
{ "type": "Feature", "properties": { "name": "9th St & Avenue H", "tippecanoe:retain_points_multiplier_sequence": 0 }, "geometry": { "type": "Point", "coordinates": [ -122.370186, 37.825243 ] } }
,
{ "type": "Feature", "properties": { "name": "Avenue H & 9th St", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 34 }, "geometry": { "type": "Point", "coordinates": [ -122.369843, 37.825243 ] } }
{ "type": "Feature", "properties": { "name": "Avenue H & 9th St", "tippecanoe:retain_points_multiplier_sequence": 34 }, "geometry": { "type": "Point", "coordinates": [ -122.369843, 37.825243 ] } }
,
{ "type": "Feature", "properties": { "name": "Avenue H & 6th St", "tippecanoe:retain_points_multiplier_sequence": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.368813, 37.823616 ] } }
,
@@ -19024,7 +19024,7 @@
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 2 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
,
@@ -19034,13 +19034,9 @@
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 10 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 11 }, "geometry": { "type": "Point", "coordinates": [ -12.239799, 37.820090 ] } }
] }
] }
,
@@ -19060,11 +19056,11 @@
,
{ "type": "Feature", "properties": { "name": "Buckingham Way & Winston Dr", "tippecanoe:retain_points_multiplier_sequence": 607 }, "geometry": { "type": "Point", "coordinates": [ -122.479019, 37.728638 ] } }
,
{ "type": "Feature", "properties": { "name": "Buckingham Way & Winston Dr", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 84 }, "geometry": { "type": "Point", "coordinates": [ -122.479019, 37.728095 ] } }
{ "type": "Feature", "properties": { "name": "Buckingham Way & Winston Dr", "tippecanoe:retain_points_multiplier_sequence": 84 }, "geometry": { "type": "Point", "coordinates": [ -122.479019, 37.728095 ] } }
,
{ "type": "Feature", "properties": { "name": "Winston Dr & Buckingham Way", "tippecanoe:retain_points_multiplier_sequence": 509 }, "geometry": { "type": "Point", "coordinates": [ -122.478676, 37.728095 ] } }
,
{ "type": "Feature", "properties": { "name": "Winston Dr & Buckingham Way", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 508 }, "geometry": { "type": "Point", "coordinates": [ -122.478504, 37.728095 ] } }
{ "type": "Feature", "properties": { "name": "Winston Dr & Buckingham Way", "tippecanoe:retain_points_multiplier_sequence": 508 }, "geometry": { "type": "Point", "coordinates": [ -122.478504, 37.728095 ] } }
,
{ "type": "Feature", "properties": { "name": "20th Av/Macy's Stonestown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 557 }, "geometry": { "type": "Point", "coordinates": [ -122.475758, 37.728774 ] } }
,
@@ -26326,33 +26322,25 @@
] }
,
{ "type": "FeatureCollection", "properties": { "layer": "subway", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { "name": "Metro Castro Station/Outbound", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ -122.435246, 37.762708 ] } }
{ "type": "Feature", "properties": { "name": "Metro Castro Station/Outbound", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -122.435246, 37.762708 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Castro Station/Downtown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -122.435246, 37.762573 ] } }
{ "type": "Feature", "properties": { "name": "Metro Castro Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 1 }, "geometry": { "type": "Point", "coordinates": [ -122.435246, 37.762573 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Forest Hill Station/Downtown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ -122.458591, 37.748322 ] } }
{ "type": "Feature", "properties": { "name": "Metro Forest Hill Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.458591, 37.748322 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Montgomery Station/Outbound", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 6 }, "geometry": { "type": "Point", "coordinates": [ -122.402115, 37.788760 ] } }
{ "type": "Feature", "properties": { "name": "Metro Montgomery Station/Outbound", "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ -122.402115, 37.788760 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Civic Center Station/Downtown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 11 }, "geometry": { "type": "Point", "coordinates": [ -122.412415, 37.780348 ] } }
{ "type": "Feature", "properties": { "name": "Metro Civic Center Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ -122.412415, 37.780348 ] } }
,
{ "type": "Feature", "properties": { "name": "Van Ness Station Outbound", "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -122.419281, 37.775192 ] } }
{ "type": "Feature", "properties": { "name": "Van Ness Station Outbound", "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ -122.419281, 37.775192 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Van Ness Station/Outbound", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 13 }, "geometry": { "type": "Point", "coordinates": [ -122.419281, 37.775057 ] } }
{ "type": "Feature", "properties": { "name": "Metro Van Ness Station/Outbound", "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ -122.419281, 37.775057 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Van Ness Station", "tippecanoe:retain_points_multiplier_sequence": 0 }, "geometry": { "type": "Point", "coordinates": [ -122.419109, 37.775057 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Van Ness Station/Downtown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 12 }, "geometry": { "type": "Point", "coordinates": [ -122.419281, 37.775057 ] } }
{ "type": "Feature", "properties": { "name": "Metro Van Ness Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -122.419281, 37.775057 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Civic Center Station/Outbd", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ -122.414989, 37.778585 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Civic Center Station/Downtn", "tippecanoe:retain_points_multiplier_sequence": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.414818, 37.778449 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Church Station/Outbound", "tippecanoe:retain_points_multiplier_sequence": 10 }, "geometry": { "type": "Point", "coordinates": [ -122.429237, 37.767322 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Church Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 1 }, "geometry": { "type": "Point", "coordinates": [ -122.429066, 37.767187 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Powell Station/Outbound", "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ -122.407780, 37.784283 ] } }
{ "type": "Feature", "properties": { "name": "Metro Civic Center Station/Outbd", "tippecanoe:retain_points_multiplier_sequence": 6 }, "geometry": { "type": "Point", "coordinates": [ -122.414989, 37.778585 ] } }
] }
] }
,
@@ -26364,23 +26352,19 @@
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 2 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 6 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 10 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 11 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.819955 ] } }
] }
] }
,
@@ -26388,23 +26372,23 @@
{ "type": "FeatureCollection", "properties": { "layer": "muni", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { "name": "John Muir Dr & Skyline Blvd", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 148 }, "geometry": { "type": "Point", "coordinates": [ -122.500048, 37.718998 ] } }
,
{ "type": "Feature", "properties": { "name": "John Muir Dr & Skyline Blvd", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 149 }, "geometry": { "type": "Point", "coordinates": [ -122.499876, 37.718726 ] } }
{ "type": "Feature", "properties": { "name": "John Muir Dr & Skyline Blvd", "tippecanoe:retain_points_multiplier_sequence": 149 }, "geometry": { "type": "Point", "coordinates": [ -122.499876, 37.718726 ] } }
,
{ "type": "Feature", "properties": { "name": "Lake Merced Blvd & Higuera Ave", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 107 }, "geometry": { "type": "Point", "coordinates": [ -122.485027, 37.718726 ] } }
,
{ "type": "Feature", "properties": { "name": "Font Blvd & Mary Ward Hall", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 437 }, "geometry": { "type": "Point", "coordinates": [ -122.483654, 37.722732 ] } }
{ "type": "Feature", "properties": { "name": "Font Blvd & Mary Ward Hall", "tippecanoe:retain_points_multiplier_sequence": 437 }, "geometry": { "type": "Point", "coordinates": [ -122.483654, 37.722732 ] } }
,
{ "type": "Feature", "properties": { "name": "Font Blvd & Mary Ward Hall", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 436 }, "geometry": { "type": "Point", "coordinates": [ -122.483053, 37.722460 ] } }
{ "type": "Feature", "properties": { "name": "Font Blvd & Mary Ward Hall", "tippecanoe:retain_points_multiplier_sequence": 436 }, "geometry": { "type": "Point", "coordinates": [ -122.483053, 37.722460 ] } }
,
{ "type": "Feature", "properties": { "name": "Font Blvd & Arballo Dr", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 77 }, "geometry": { "type": "Point", "coordinates": [ -122.482538, 37.721849 ] } }
{ "type": "Feature", "properties": { "name": "Font Blvd & Arballo Dr", "tippecanoe:retain_points_multiplier_sequence": 77 }, "geometry": { "type": "Point", "coordinates": [ -122.482538, 37.721849 ] } }
,
{ "type": "Feature", "properties": { "name": "Font Blvd & Arballo Dr", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 76 }, "geometry": { "type": "Point", "coordinates": [ -122.482109, 37.721781 ] } }
{ "type": "Feature", "properties": { "name": "Font Blvd & Arballo Dr", "tippecanoe:retain_points_multiplier_sequence": 76 }, "geometry": { "type": "Point", "coordinates": [ -122.482109, 37.721781 ] } }
,
{ "type": "Feature", "properties": { "name": "Arballo Dr & Pinto Dr", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 36 }, "geometry": { "type": "Point", "coordinates": [ -122.483053, 37.720763 ] } }
{ "type": "Feature", "properties": { "name": "Arballo Dr & Pinto Dr", "tippecanoe:retain_points_multiplier_sequence": 36 }, "geometry": { "type": "Point", "coordinates": [ -122.483053, 37.720763 ] } }
,
{ "type": "Feature", "properties": { "name": "Arballo Dr & Acevedo Ave .", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 32 }, "geometry": { "type": "Point", "coordinates": [ -122.483139, 37.719880 ] } }
{ "type": "Feature", "properties": { "name": "Arballo Dr & Acevedo Ave .", "tippecanoe:retain_points_multiplier_sequence": 32 }, "geometry": { "type": "Point", "coordinates": [ -122.483139, 37.719880 ] } }
,
{ "type": "Feature", "properties": { "name": "Arballo Dr & Higuera Ave", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 35 }, "geometry": { "type": "Point", "coordinates": [ -122.483225, 37.718590 ] } }
{ "type": "Feature", "properties": { "name": "Arballo Dr & Higuera Ave", "tippecanoe:retain_points_multiplier_sequence": 35 }, "geometry": { "type": "Point", "coordinates": [ -122.483225, 37.718590 ] } }
,
{ "type": "Feature", "properties": { "name": "Font Blvd & Tapia Dr NS/W/SB", "tippecanoe:retain_points_multiplier_sequence": 428 }, "geometry": { "type": "Point", "coordinates": [ -122.481251, 37.720763 ] } }
,
@@ -27272,15 +27256,15 @@
{ "type": "FeatureCollection", "properties": { "layer": "muni", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { "name": "Fort Cronkhite Parking Lot", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 1034 }, "geometry": { "type": "Point", "coordinates": [ -122.538671, 37.832361 ] } }
,
{ "type": "Feature", "properties": { "name": "MITCHELL RD/Visitor's Center", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 1557 }, "geometry": { "type": "Point", "coordinates": [ -122.536268, 37.831751 ] } }
{ "type": "Feature", "properties": { "name": "MITCHELL RD/Visitor's Center", "tippecanoe:retain_points_multiplier_sequence": 1557 }, "geometry": { "type": "Point", "coordinates": [ -122.536268, 37.831751 ] } }
,
{ "type": "Feature", "properties": { "name": "Mitchell Rd & Bunker Rd", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 1555 }, "geometry": { "type": "Point", "coordinates": [ -122.532406, 37.831819 ] } }
,
{ "type": "Feature", "properties": { "name": "Mitchell Rd & Bunker Rd", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 1556 }, "geometry": { "type": "Point", "coordinates": [ -122.530861, 37.831887 ] } }
{ "type": "Feature", "properties": { "name": "Mitchell Rd & Bunker Rd", "tippecanoe:retain_points_multiplier_sequence": 1556 }, "geometry": { "type": "Point", "coordinates": [ -122.530861, 37.831887 ] } }
,
{ "type": "Feature", "properties": { "name": "BUNKER RD/Miwok Trail", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 536 }, "geometry": { "type": "Point", "coordinates": [ -122.527256, 37.832565 ] } }
,
{ "type": "Feature", "properties": { "name": "BUNKER RD/Miwok Trail", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 537 }, "geometry": { "type": "Point", "coordinates": [ -122.527170, 37.832497 ] } }
{ "type": "Feature", "properties": { "name": "BUNKER RD/Miwok Trail", "tippecanoe:retain_points_multiplier_sequence": 537 }, "geometry": { "type": "Point", "coordinates": [ -122.527170, 37.832497 ] } }
,
{ "type": "Feature", "properties": { "name": "FIELD RD/Youth Hostel", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 968 }, "geometry": { "type": "Point", "coordinates": [ -122.523479, 37.831684 ] } }
,
@@ -32508,43 +32492,25 @@
] }
,
{ "type": "FeatureCollection", "properties": { "layer": "subway", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { "name": "Metro Castro Station/Outbound", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -122.435331, 37.762708 ] } }
{ "type": "Feature", "properties": { "name": "Metro Castro Station/Outbound", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ -122.435331, 37.762708 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Castro Station/Downtown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ -122.435246, 37.762641 ] } }
{ "type": "Feature", "properties": { "name": "Metro Castro Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 0 }, "geometry": { "type": "Point", "coordinates": [ -122.435246, 37.762641 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Forest Hill Station/Downtown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 6 }, "geometry": { "type": "Point", "coordinates": [ -122.458591, 37.748322 ] } }
{ "type": "Feature", "properties": { "name": "Metro Forest Hill Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.458591, 37.748322 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Montgomery Station/Outbound", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 10 }, "geometry": { "type": "Point", "coordinates": [ -122.402115, 37.788760 ] } }
{ "type": "Feature", "properties": { "name": "Metro Montgomery Station/Outbound", "tippecanoe:retain_points_multiplier_sequence": 6 }, "geometry": { "type": "Point", "coordinates": [ -122.402115, 37.788760 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Montgomery Station/Downtown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ -122.401943, 37.788692 ] } }
{ "type": "Feature", "properties": { "name": "Metro Montgomery Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -122.401943, 37.788692 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Embarcadero Station/Downtown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ -122.396536, 37.793033 ] } }
{ "type": "Feature", "properties": { "name": "Metro Embarcadero Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 1 }, "geometry": { "type": "Point", "coordinates": [ -122.396536, 37.793033 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Embarcadero Station", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 17 }, "geometry": { "type": "Point", "coordinates": [ -122.396450, 37.793168 ] } }
{ "type": "Feature", "properties": { "name": "Metro Embarcadero Station", "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ -122.396450, 37.793168 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Embarcadero Station", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ -122.396364, 37.793168 ] } }
{ "type": "Feature", "properties": { "name": "Metro Embarcadero Station", "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ -122.396364, 37.793168 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Civic Center Station/Downtown", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 15 }, "geometry": { "type": "Point", "coordinates": [ -122.412500, 37.780348 ] } }
{ "type": "Feature", "properties": { "name": "Metro Civic Center Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -122.412500, 37.780348 ] } }
,
{ "type": "Feature", "properties": { "name": "Van Ness Station Outbound", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 12 }, "geometry": { "type": "Point", "coordinates": [ -122.419367, 37.775260 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Van Ness Station/Outbound", "tippecanoe:retain_points_multiplier_sequence": 18 }, "geometry": { "type": "Point", "coordinates": [ -122.419281, 37.775125 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Van Ness Station", "tippecanoe:retain_points_multiplier_sequence": 1 }, "geometry": { "type": "Point", "coordinates": [ -122.419195, 37.775057 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Van Ness Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 16 }, "geometry": { "type": "Point", "coordinates": [ -122.419281, 37.775057 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Civic Center Station/Outbd", "tippecanoe:retain_points_multiplier_sequence": 13 }, "geometry": { "type": "Point", "coordinates": [ -122.414989, 37.778652 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Civic Center Station/Downtn", "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -122.414818, 37.778517 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Church Station/Outbound", "tippecanoe:retain_points_multiplier_sequence": 14 }, "geometry": { "type": "Point", "coordinates": [ -122.429323, 37.767322 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Church Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.429152, 37.767187 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Powell Station/Outbound", "tippecanoe:retain_points_multiplier_sequence": 11 }, "geometry": { "type": "Point", "coordinates": [ -122.407780, 37.784283 ] } }
,
{ "type": "Feature", "properties": { "name": "Metro Powell Station/Downtown", "tippecanoe:retain_points_multiplier_sequence": 0 }, "geometry": { "type": "Point", "coordinates": [ -122.407694, 37.784215 ] } }
{ "type": "Feature", "properties": { "name": "Van Ness Station Outbound", "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ -122.419367, 37.775260 ] } }
] }
] }
,
@@ -32552,27 +32518,23 @@
{ "type": "FeatureCollection", "properties": { "layer": "muni", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 0 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 1 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 1 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 2 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 2 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 3 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 6 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 6 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_first": true, "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 10 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
,
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 11 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ -12.239971, 37.820023 ] } }
] }
] }
] }
File diff suppressed because one or more lines are too long
+43 -37
View File
@@ -1053,10 +1053,15 @@ static bool skip_next_feature(decompressor *geoms, std::atomic<long long> *geomp
return true;
}
struct next_feature_state {
unsigned long long previndex = 0;
unsigned long long prev_not_dropped_index = 0;
};
// This function is called repeatedly from write_tile() to retrieve the next feature
// from the input stream. If the stream is at an end, it returns a feature with the
// geometry type set to -2.
static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *geompos_in, int z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y, long long *original_features, long long *unclipped_features, int nextzoom, int maxzoom, int minzoom, int max_zoom_increment, size_t pass, std::atomic<long long> *along, long long alongminus, int buffer, std::atomic<bool> *within, compressor **geomfile, std::atomic<long long> *geompos, long long start_geompos[], std::atomic<double> *oprogress, double todo, const char *fname, int child_shards, json_object *filter, const char *global_stringpool, long long *pool_off, std::vector<std::vector<std::string>> *layer_unmaps, bool first_time, bool compressed, multiplier_state *multiplier_state, std::shared_ptr<std::string> &tile_stringpool, std::vector<std::string> const &unidecode_data, unsigned long long &previndex, double droprate) {
static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *geompos_in, int z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y, long long *original_features, long long *unclipped_features, int nextzoom, int maxzoom, int minzoom, int max_zoom_increment, size_t pass, std::atomic<long long> *along, long long alongminus, int buffer, std::atomic<bool> *within, compressor **geomfile, std::atomic<long long> *geompos, long long start_geompos[], std::atomic<double> *oprogress, double todo, const char *fname, int child_shards, json_object *filter, const char *global_stringpool, long long *pool_off, std::vector<std::vector<std::string>> *layer_unmaps, bool first_time, bool compressed, multiplier_state *multiplier_state, std::shared_ptr<std::string> &tile_stringpool, std::vector<std::string> const &unidecode_data, next_feature_state &next_feature_state, double droprate) {
double extra_multiplier_zooms = log(retain_points_multiplier) / log(droprate);
while (1) {
serial_feature sf;
@@ -1114,12 +1119,12 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
(*original_features)++;
if (sf.gap == 0) {
if (sf.index != previndex) {
if (sf.index != next_feature_state.previndex) {
long long ox = (1LL << (32 - z)) * tx;
long long oy = (1LL << (32 - z)) * ty;
unsigned wx1, wy1;
decode_index(previndex, &wx1, &wy1);
decode_index(next_feature_state.previndex, &wx1, &wy1);
for (auto const &g : sf.geometry) {
long long dx = (long long) wx1 - (g.x + ox);
@@ -1132,7 +1137,7 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
}
}
}
previndex = sf.index;
next_feature_state.previndex = sf.index;
if (clip_to_tile(sf, z, buffer)) {
continue;
@@ -1237,6 +1242,9 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
} else if (z + extra_multiplier_zooms >= feature_minzoom && count->second + 1 < retain_points_multiplier) {
count->second++;
sf.dropped = count->second;
} else if (preserve_multiplier_density_threshold > 0 &&
sf.index - next_feature_state.prev_not_dropped_index > ((1LL << (32 - z)) / preserve_multiplier_density_threshold) * ((1LL << (32 - z)) / preserve_multiplier_density_threshold)) {
sf.dropped = FEATURE_ADDED_FOR_MULTIPLIER_DENSITY;
} else {
sf.dropped = FEATURE_DROPPED;
}
@@ -1244,6 +1252,10 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
sf.dropped = FEATURE_KEPT;
}
if (sf.dropped != FEATURE_DROPPED) {
next_feature_state.prev_not_dropped_index = sf.index;
}
// Remove nulls, now that the expression evaluation filter has run
for (ssize_t i = (ssize_t) sf.keys.size() - 1; i >= 0; i--) {
@@ -1308,10 +1320,10 @@ void *run_prefilter(void *v) {
json_writer state(rpa->prefilter_fp);
struct multiplier_state multiplier_state;
std::shared_ptr<std::string> tile_stringpool = std::make_shared<std::string>();
unsigned long long previndex = 0;
next_feature_state next_feature_state;
while (1) {
serial_feature sf = next_feature(rpa->geoms, rpa->geompos_in, rpa->z, rpa->tx, rpa->ty, rpa->initial_x, rpa->initial_y, rpa->original_features, rpa->unclipped_features, rpa->nextzoom, rpa->maxzoom, rpa->minzoom, rpa->max_zoom_increment, rpa->pass, rpa->along, rpa->alongminus, rpa->buffer, rpa->within, rpa->geomfile, rpa->geompos, rpa->start_geompos, rpa->oprogress, rpa->todo, rpa->fname, rpa->child_shards, rpa->filter, rpa->global_stringpool, rpa->pool_off, rpa->layer_unmaps, rpa->first_time, rpa->compressed, &multiplier_state, tile_stringpool, *(rpa->unidecode_data), previndex, rpa->droprate);
serial_feature sf = next_feature(rpa->geoms, rpa->geompos_in, rpa->z, rpa->tx, rpa->ty, rpa->initial_x, rpa->initial_y, rpa->original_features, rpa->unclipped_features, rpa->nextzoom, rpa->maxzoom, rpa->minzoom, rpa->max_zoom_increment, rpa->pass, rpa->along, rpa->alongminus, rpa->buffer, rpa->within, rpa->geomfile, rpa->geompos, rpa->start_geompos, rpa->oprogress, rpa->todo, rpa->fname, rpa->child_shards, rpa->filter, rpa->global_stringpool, rpa->pool_off, rpa->layer_unmaps, rpa->first_time, rpa->compressed, &multiplier_state, tile_stringpool, *(rpa->unidecode_data), next_feature_state, rpa->droprate);
if (sf.t < 0) {
break;
}
@@ -1523,24 +1535,17 @@ void preserve_attributes(std::unordered_map<std::string, attribute_op> const *at
// This function finds the feature in `features` onto which the attributes or geometry
// of a feature that is being dropped (`sf`) will be accumulated or coalesced. It
// ordinarily returns the most recently-added feature from the same layer as the feature
// that is being dropped, but if there is an active multiplier, will walk multiple
// features backward so that the features being dropped will be accumulated round-robin
// onto the N features that are being kept. The caller increments the `multiplier_seq`
// mod N with each dropped feature to drive the round-robin decision.
// that is being dropped.
//
bool find_feature_to_accumulate_onto(std::vector<serial_feature> &features, serial_feature &sf, ssize_t &out, std::vector<std::vector<std::string>> *layer_unmaps, long long maxextent, ssize_t multiplier_seq) {
bool find_feature_to_accumulate_onto(std::vector<serial_feature> &features, serial_feature &sf, ssize_t &out, std::vector<std::vector<std::string>> *layer_unmaps, long long maxextent) {
for (size_t i = features.size(); i > 0; i--) {
if (features[i - 1].t == sf.t) {
std::string &layername1 = (*layer_unmaps)[features[i - 1].segment][features[i - 1].layer];
std::string &layername2 = (*layer_unmaps)[sf.segment][sf.layer];
if (layername1 == layername2 && features[i - 1].extent <= maxextent) {
if (multiplier_seq <= 0) {
out = i - 1;
return true;
}
multiplier_seq--;
out = i - 1;
return true;
}
}
}
@@ -1615,10 +1620,10 @@ struct layer_features {
size_t multiplier_cluster_size = 0; // The feature count of the current multiplier cluster
};
bool drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer_features &layer, serial_feature &sf, std::vector<std::vector<std::string>> *layer_unmaps, size_t &multiplier_seq, strategy &strategy, bool &drop_rest, std::unordered_map<std::string, attribute_op> const *attribute_accum) {
bool drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer_features &layer, serial_feature &sf, std::vector<std::vector<std::string>> *layer_unmaps, strategy &strategy, bool &drop_rest, std::unordered_map<std::string, attribute_op> const *attribute_accum) {
ssize_t which_serial_feature;
if (find_feature_to_accumulate_onto(layer.features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
if (find_feature_to_accumulate_onto(layer.features, sf, which_serial_feature, layer_unmaps, LLONG_MAX)) {
strategy.dropped_as_needed++;
if (layer.multiplier_cluster_size < (size_t) retain_points_multiplier) {
// we have capacity to keep this feature as part of an existing multiplier cluster that isn't full yet
@@ -1837,10 +1842,10 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
// Read features, filter them, assign them to layers
struct multiplier_state multiplier_state;
size_t multiplier_seq = retain_points_multiplier - 1;
bool drop_rest = false; // are we dropping the remainder of a multiplier cluster whose first point was dropped?
bool dropping_by_rate = false; // are we dropping anything by rate in this tile, or keeping it only as part of a multiplier?
unsigned long long next_feature_previndex = 0;
next_feature_state next_feature_state;
strategy strategy;
strategy.detail_reduced = detail_reduced;
@@ -1850,7 +1855,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
ssize_t which_serial_feature = -1;
if (prefilter == NULL) {
sf = next_feature(geoms, geompos_in, z, tx, ty, initial_x, initial_y, &original_features, &unclipped_features, nextzoom, maxzoom, minzoom, max_zoom_increment, pass, along, alongminus, buffer, within, geomfile, geompos, start_geompos, &oprogress, todo, fname, child_shards, filter, global_stringpool, pool_off, layer_unmaps, first_time, compressed_input, &multiplier_state, tile_stringpool, unidecode_data, next_feature_previndex, arg->droprate);
sf = next_feature(geoms, geompos_in, z, tx, ty, initial_x, initial_y, &original_features, &unclipped_features, nextzoom, maxzoom, minzoom, max_zoom_increment, pass, along, alongminus, buffer, within, geomfile, geompos, start_geompos, &oprogress, todo, fname, child_shards, filter, global_stringpool, pool_off, layer_unmaps, first_time, compressed_input, &multiplier_state, tile_stringpool, unidecode_data, next_feature_state, arg->droprate);
} else {
sf = parse_feature(prefilter_jp, z, tx, ty, layermaps, tiling_seg, layer_unmaps, postfilter != NULL);
}
@@ -1898,8 +1903,11 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
} else {
can_stop_early = false;
if (sf.dropped != FEATURE_DROPPED) {
if (sf.dropped != FEATURE_DROPPED && sf.dropped != FEATURE_ADDED_FOR_MULTIPLIER_DENSITY) {
// Does the current multiplier cluster already have too many features?
// (Because we are dropping dynamically, and we have already filled the
// cluster with features that were dynamically dropped from being
// primary features)
// If so, we have to drop this one, even if it would potentially qualify
// as a secondary feature to be exposed by filtering
if (layer.multiplier_cluster_size >= (size_t) retain_points_multiplier) {
@@ -1909,16 +1917,12 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
}
if (sf.dropped == FEATURE_DROPPED || drop_rest) {
multiplier_seq = 0;
if (find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
if (find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX)) {
preserve_attributes(arg->attribute_accum, sf, features[which_serial_feature]);
strategy.dropped_by_rate++;
can_stop_early = false;
continue;
}
} else {
multiplier_seq = retain_points_multiplier - 1;
}
// only the first point of a multiplier cluster can be dropped
@@ -1926,7 +1930,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
// cluster down with it by setting drop_rest).
if (sf.dropped == FEATURE_KEPT) {
if (gamma > 0) {
if (manage_gap(sf.index, &previndex, scale, gamma, &gap) && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
if (manage_gap(sf.index, &previndex, scale, gamma, &gap) && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX)) {
preserve_attributes(arg->attribute_accum, sf, features[which_serial_feature]);
strategy.dropped_by_gamma++;
drop_rest = true;
@@ -1941,7 +1945,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
// distances between points that are subject to dot-dropping,
// rather than wanting each feature to have a consistent
// idea of density between zooms.
if ((sf.index < merge_previndex || sf.index - merge_previndex < cluster_mingap) && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
if ((sf.index < merge_previndex || sf.index - merge_previndex < cluster_mingap) && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX)) {
features[which_serial_feature].clustered++;
if (features[which_serial_feature].t == VT_POINT &&
@@ -1965,7 +1969,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
add_sample_to(gaps, sf.gap, gaps_increment, seq);
if (sf.gap < mingap) {
can_stop_early = false;
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, multiplier_seq, strategy, drop_rest, arg->attribute_accum)) {
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, strategy, drop_rest, arg->attribute_accum)) {
continue;
}
}
@@ -1973,7 +1977,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
// this is now just like coalesce-densest, except that instead of unioning the geometry,
// it averages the point locations
add_sample_to(gaps, sf.gap, gaps_increment, seq);
if (sf.gap < mingap && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
if (sf.gap < mingap && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX)) {
features[which_serial_feature].clustered++;
if (features[which_serial_feature].t == VT_POINT &&
@@ -1994,7 +1998,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
}
} else if (additional[A_COALESCE_DENSEST_AS_NEEDED]) {
add_sample_to(gaps, sf.gap, gaps_increment, seq);
if (sf.gap < mingap && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
if (sf.gap < mingap && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX)) {
coalesce_geometry(features[which_serial_feature], sf);
features[which_serial_feature].coalesced = true;
coalesced_area += sf.extent;
@@ -2010,13 +2014,13 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
// so we shouldn't expect to find anything small that we can related this feature to.
if (minextent != 0 && sf.extent + coalesced_area <= minextent) {
can_stop_early = false;
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, multiplier_seq, strategy, drop_rest, arg->attribute_accum)) {
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, strategy, drop_rest, arg->attribute_accum)) {
continue;
}
}
} else if (additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
add_sample_to(extents, sf.extent, extents_increment, seq);
if (minextent != 0 && sf.extent + coalesced_area <= minextent && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, minextent, multiplier_seq)) {
if (minextent != 0 && sf.extent + coalesced_area <= minextent && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, minextent)) {
coalesce_geometry(features[which_serial_feature], sf);
features[which_serial_feature].coalesced = true;
coalesced_area += sf.extent;
@@ -2030,13 +2034,13 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
add_sample_to(drop_sequences, drop_sequence, drop_sequences_increment, seq);
if (mindrop_sequence != 0 && drop_sequence <= mindrop_sequence) {
can_stop_early = false;
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, multiplier_seq, strategy, drop_rest, arg->attribute_accum)) {
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, strategy, drop_rest, arg->attribute_accum)) {
continue;
}
}
} else if (additional[A_COALESCE_FRACTION_AS_NEEDED]) {
add_sample_to(drop_sequences, drop_sequence, drop_sequences_increment, seq);
if (mindrop_sequence != 0 && drop_sequence <= mindrop_sequence && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
if (mindrop_sequence != 0 && drop_sequence <= mindrop_sequence && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX)) {
coalesce_geometry(features[which_serial_feature], sf);
features[which_serial_feature].coalesced = true;
preserve_attributes(arg->attribute_accum, sf, features[which_serial_feature]);
@@ -2146,6 +2150,8 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
if (sf.dropped == FEATURE_KEPT) {
layer.multiplier_cluster_size = 1;
lead_features_count++;
} else if (sf.dropped == FEATURE_ADDED_FOR_MULTIPLIER_DENSITY) {
other_multiplier_cluster_features_count++;
} else {
layer.multiplier_cluster_size++;
other_multiplier_cluster_features_count++;