mirror of
https://github.com/felt/tippecanoe.git
synced 2026-11-27 10:51:17 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12f828e555 | ||
|
|
8193c716c7 | ||
|
|
90d6edbc38 | ||
|
|
2d548bed06 |
@@ -1,3 +1,14 @@
|
||||
# 2.78.0
|
||||
|
||||
* Fix potential infinite loops in as-needed dropping and coalescing.
|
||||
When the threshold cannot be increased, it is now an error, rather than
|
||||
falling back to trying to lower the detail.
|
||||
* Cleaning of complex polygon geometries now happens in stages
|
||||
to avoid performance problems when there are very large numbers
|
||||
of vertices.
|
||||
* Label point generation happens earlier in tiling, to avoid doing slow
|
||||
operations on polygons that will not be retained anyway.
|
||||
|
||||
# 2.77.0
|
||||
|
||||
* Add --deduplicate-by-id option to tippecanoe-overzoom
|
||||
|
||||
@@ -2543,6 +2543,7 @@ void coalesce_polygon(drawvec &geom, bool scale_up) {
|
||||
|
||||
// Clean the combined geometry
|
||||
geom = clean_or_clip_poly(geom, 0, 0, false, scale_up);
|
||||
return;
|
||||
}
|
||||
|
||||
i = j - 1;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
"maxzoom": "2",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_admin_0_countries/out/-z2_--convert-polygons-to-label-points.json.check.mbtiles",
|
||||
"strategies": "[{},{},{\"tiny_polygons\":1}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
-1216
File diff suppressed because one or more lines are too long
+1906
File diff suppressed because one or more lines are too long
@@ -541,7 +541,6 @@ struct simplification_worker_arg {
|
||||
std::vector<std::shared_ptr<serial_feature>> *features = NULL;
|
||||
int task = 0;
|
||||
int tasks = 0;
|
||||
bool trying_to_stop_early = false;
|
||||
|
||||
drawvec *shared_nodes;
|
||||
node *shared_nodes_map;
|
||||
@@ -676,9 +675,7 @@ static void *simplification_worker(void *v) {
|
||||
|
||||
for (size_t i = a->task; i < (*features).size(); i += a->tasks) {
|
||||
double area = 0;
|
||||
if (!a->trying_to_stop_early) {
|
||||
area = simplify_feature(&*((*features)[i]), *(a->shared_nodes), a->shared_nodes_map, a->nodepos, *(a->shared_nodes_bloom));
|
||||
}
|
||||
area = simplify_feature(&*((*features)[i]), *(a->shared_nodes), a->shared_nodes_map, a->nodepos, *(a->shared_nodes_bloom));
|
||||
|
||||
signed char t = (*features)[i]->t;
|
||||
int z = (*features)[i]->z;
|
||||
@@ -693,20 +690,18 @@ static void *simplification_worker(void *v) {
|
||||
{
|
||||
drawvec before = geom;
|
||||
|
||||
if (!a->trying_to_stop_early) {
|
||||
// we can try scaling up because this is now tile scale
|
||||
coalesce_polygon(geom, true);
|
||||
if (additional[A_DEBUG_POLYGON]) {
|
||||
check_polygon(geom);
|
||||
}
|
||||
// we can try scaling up because this is now tile scale
|
||||
coalesce_polygon(geom, true);
|
||||
if (additional[A_DEBUG_POLYGON]) {
|
||||
check_polygon(geom);
|
||||
}
|
||||
|
||||
if (geom.size() < 3) {
|
||||
if (area > 0) {
|
||||
// area is in world coordinates, calculated before scaling down
|
||||
geom = revive_polygon(before, area, z, out_detail);
|
||||
} else {
|
||||
geom.clear();
|
||||
}
|
||||
if (geom.size() < 3) {
|
||||
if (area > 0) {
|
||||
// area is in world coordinates, calculated before scaling down
|
||||
geom = revive_polygon(before, area, z, out_detail);
|
||||
} else {
|
||||
geom.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1653,7 +1648,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
int first_detail = detail, second_detail = detail - 1;
|
||||
bool trying_to_stop_early = false;
|
||||
bool can_stop_early = true;
|
||||
if (additional[A_VARIABLE_DEPTH_PYRAMID]) {
|
||||
if (additional[A_VARIABLE_DEPTH_PYRAMID] && mingap == 0 && minextent == 0 && mindrop_sequence == 0) {
|
||||
// If we are trying to stop early, there is an extra first pass with full+extra detail,
|
||||
// and which loops if everything doesn't fit rather than trying to drop or union features.
|
||||
|
||||
@@ -2003,7 +1998,9 @@ 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)) {
|
||||
coalesce_geometry(*features[which_serial_feature], sf);
|
||||
if (sf.t == VT_POINT || !line_is_too_small(sf.geometry, z, line_detail)) {
|
||||
coalesce_geometry(*features[which_serial_feature], sf);
|
||||
}
|
||||
features[which_serial_feature]->coalesced = true;
|
||||
coalesced_area += sf.extent;
|
||||
preserve_attributes(arg->attribute_accum, sf, *features[which_serial_feature], key_pool);
|
||||
@@ -2025,7 +2022,9 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
} 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)) {
|
||||
coalesce_geometry(*features[which_serial_feature], sf);
|
||||
if (sf.t == VT_POINT || !line_is_too_small(sf.geometry, z, line_detail)) {
|
||||
coalesce_geometry(*features[which_serial_feature], sf);
|
||||
}
|
||||
features[which_serial_feature]->coalesced = true;
|
||||
coalesced_area += sf.extent;
|
||||
preserve_attributes(arg->attribute_accum, sf, *features[which_serial_feature], key_pool);
|
||||
@@ -2045,7 +2044,9 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
} 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)) {
|
||||
coalesce_geometry(*features[which_serial_feature], sf);
|
||||
if (sf.t == VT_POINT || !line_is_too_small(sf.geometry, z, line_detail)) {
|
||||
coalesce_geometry(*features[which_serial_feature], sf);
|
||||
}
|
||||
features[which_serial_feature]->coalesced = true;
|
||||
preserve_attributes(arg->attribute_accum, sf, *features[which_serial_feature], key_pool);
|
||||
strategy.coalesced_as_needed++;
|
||||
@@ -2179,6 +2180,12 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
sf.clustered = 0;
|
||||
sf.tile_stringpool = tile_stringpool;
|
||||
|
||||
if (trying_to_stop_early && line_detail == first_detail) {
|
||||
// only remove collinearities;
|
||||
// leave all other vertices for extreme overzooming
|
||||
sf.simplification = 0;
|
||||
}
|
||||
|
||||
if (line_detail == detail && extra_detail >= 0 && z == maxzoom) {
|
||||
sf.extra_detail = extra_detail;
|
||||
// maximum allowed coordinate delta in geometries is 2^31 - 1
|
||||
@@ -2387,7 +2394,6 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
args[i].shared_nodes_map = shared_nodes_map;
|
||||
args[i].nodepos = nodepos;
|
||||
args[i].shared_nodes_bloom = &shared_nodes_bloom;
|
||||
args[i].trying_to_stop_early = trying_to_stop_early;
|
||||
|
||||
if (tasks > 1) {
|
||||
if (thread_create(&pthreads[i], NULL, simplification_worker, &args[i]) != 0) {
|
||||
@@ -2504,6 +2510,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
// this is maxzoom; ok to stop early still because they said to limit abruptly
|
||||
layer_features.resize(limit_tile_feature_count_at_maxzoom);
|
||||
too_many_features = false; // don't try to drop; we have already truncated
|
||||
too_many_bytes = false; // don't try to drop; we have already truncated
|
||||
skipped = 0; // doesn't matter that we skipped features; we have truncated
|
||||
}
|
||||
} else if (limit_tile_feature_count != 0) {
|
||||
@@ -2511,6 +2518,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
can_stop_early = false;
|
||||
layer_features.resize(limit_tile_feature_count);
|
||||
too_many_features = false; // don't try to drop; we have already truncated
|
||||
too_many_bytes = false; // don't try to drop; we have already truncated
|
||||
skipped = 0; // doesn't matter that we skipped features; we have truncated
|
||||
}
|
||||
}
|
||||
@@ -2773,7 +2781,6 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
|
||||
if (trying_to_stop_early && line_detail == first_detail) {
|
||||
// didn't work, try a lower detail
|
||||
detail_reduced++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3004,7 +3011,21 @@ exit(EXIT_IMPOSSIBLE);
|
||||
long long len;
|
||||
|
||||
struct zxy parent(z - 1, x / 2, y / 2);
|
||||
bool skip = false;
|
||||
if (arg->skip_children->count(parent) > 0) {
|
||||
if (arg->mingap != 0 || arg->minextent != 0 || arg->mindrop_sequence != 0) {
|
||||
// revive if we are trying to drop features and we still have the data
|
||||
skip = false;
|
||||
} else {
|
||||
// skip if the parent tile finished at the last zoom level and we aren't trying to drop
|
||||
skip = true;
|
||||
}
|
||||
} else {
|
||||
// do the tile if the parent didn't finish early
|
||||
skip = false;
|
||||
}
|
||||
|
||||
if (skip) {
|
||||
skip_tile(&dc, &geompos, arg->compressed);
|
||||
len = 1;
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v2.77.0"
|
||||
#define VERSION "v2.78.0"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user