Compare commits

..
Author SHA1 Message Date
Erica Fischer 8780064cde Merge remote-tracking branch 'origin/main' into faster-bin-assign 2025-07-10 12:37:15 -07:00
Drew Good 6dd49be6c9 Fix incorrect file reference in lambda README (#356) 2025-07-02 16:38:55 -07:00
Drew Good c2a973d8f6 docs: fix typos in readme (#355) 2025-07-02 16:36:36 -07:00
Drew Good 8ac730718a fix broken links in MADE_WITH.md (#354) 2025-07-02 16:28:02 -07:00
Erica Fischer 2d548bed06 Infinite loop fixes, minimizing changes to behavior (#345)
* Divide-and-conquer polygon cleaning

* Catch the case where the gap can't be increased further

* Catch the case where we try to keep impossibly many features

* Make label points earlier in the tiling process

* Another case where it could try to drop even after already limiting.

* And do not coalesce on impossibly small geometries

* Add missing return

* Update version and changelog
2025-05-09 09:08:28 -07:00
Erica Fischer 5d01a067aa Merge remote-tracking branch 'origin/main' into faster-bin-assign 2025-03-28 13:21:34 -07:00
Erica Fischer 355cc31d5b Indirect lists of mvt_feature through pointers for faster sorting 2025-02-12 11:32:28 -08:00
Erica Fischer 9d00c92ff2 Do less work when assigning bins by ID 2025-02-12 10:31:27 -08:00
15 changed files with 197 additions and 149 deletions
+11
View File
@@ -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
+5 -5
View File
@@ -1,19 +1,19 @@
## [Visualizing a Month of Lightning](http://rousseau.io/2015/03/23/visualizing-a-month-of-lightning) by Jordan Rousseau
## [Visualizing a Month of Lightning](https://medium.com/@jvrousseau/visualizing-a-month-of-lightning-8ab63d040d8c) by Jordan Rousseau
![](http://rousseau.io/assets/img/ltg-studio-style.png)
## [Making the most detailed tweet map ever](https://www.mapbox.com/blog/twitter-map-every-tweet/) by Eric Fischer
## [Making the most detailed tweet map ever](https://web.archive.org/web/20161220144946/https://www.mapbox.com/blog/twitter-map-every-tweet/) by Eric Fischer
![](https://farm8.staticflickr.com/7505/15869589271_8a02e84c24_b.jpg)
## [Superpowering Runkeeper's 1.5 million walks, runs, and bike rides](https://www.mapbox.com/blog/runkeeper-million-routes/)
## [Superpowering Runkeeper's 1.5 million walks, runs, and bike rides](https://web.archive.org/web/20161219225305/https://www.mapbox.com/blog/runkeeper-million-routes/)
![](https://c1.staticflickr.com/9/8605/15852245980_1ecf0894b8_b.jpg)
## [The Geotaggers' World Atlas](https://www.mapbox.com/blog/geotaggers-world-atlas/) by Eric Fischer
## [The Geotaggers' World Atlas](https://web.archive.org/web/20170319084321/https://www.mapbox.com/blog/geotaggers-world-atlas/) by Eric Fischer
![](http://farm8.staticflickr.com/7634/17040546408_0a14752e6d_b.jpg)
## [Atmospheric River](https://www.mapbox.com/blog/atmospheric-river/)
## [Atmospheric River](https://web.archive.org/web/20161011171030/https://www.mapbox.com/blog/atmospheric-river/)
![](http://farm9.staticflickr.com/8630/16253097589_4dfc706b22_b.jpg)
+2 -2
View File
@@ -475,7 +475,7 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
* `-K` _distance_ or `--cluster-distance=`_distance_: Cluster points (as with `--cluster-densest-as-needed`, but without the experimental discovery process) that are approximately within _distance_ of each other. The units are tile coordinates within a nominally 256-pixel tile, so the maximum value of 255 allows only one feature per tile. Values around 10 are probably appropriate for typical marker sizes. See `--cluster-densest-as-needed` below for behavior.
* `-k` _zoom_ or `--cluster-maxzoom=`_zoom_: Max zoom on which to cluster points if clustering is enabled.
* `-kg` or `--cluster-maxzoom=g`: Set `--cluster-maxzoom=` to `maxzoom - 1` so that all features are visible at the maximum zoom level.
* `--preserve-point-density-threshold=`_level_: At the low zoom levels, do not reduce point density below the specified _level_, even if the specfied drop rate would normally call for it, so that low-density areas of the map do not appear blank. The unit is the distance between preserved points, as a fraction of the size of a tile. Values of 32 or 64 are probably appropriate for typical marker sizes.
* `--preserve-point-density-threshold=`_level_: At the low zoom levels, do not reduce point density below the specified _level_, even if the specified drop rate would normally call for it, so that low-density areas of the map do not appear blank. The unit is the distance between preserved points, as a fraction of the size of a tile. Values of 32 or 64 are probably appropriate for typical marker sizes.
### Dropping a fraction of features to keep under tile size limits
@@ -719,7 +719,7 @@ and perhaps
make install
Tippecanoe now requires features from the 2011 C++ standard. If your compiler is older than
that, you will need to install a newer one. On MacOS, updating to the lastest XCode should
that, you will need to install a newer one. On MacOS, updating to the latest XCode should
get you a new enough version of `clang++`. On Linux, you should be able to upgrade `g++` with
```
+140 -110
View File
@@ -1683,7 +1683,7 @@ static bool feature_out(std::vector<tile_feature> const &features, mvt_layer &ou
}
}
outlayer.features.push_back(std::move(outfeature));
outlayer.features.push_back(std::make_shared<mvt_feature>(outfeature));
return true;
}
@@ -1694,6 +1694,9 @@ static struct preservecmp {
bool operator()(const mvt_feature &a, const mvt_feature &b) {
return a.seq < b.seq;
}
bool operator()(const std::shared_ptr<mvt_feature> &a, const std::shared_ptr<mvt_feature> &b) {
return a->seq < b->seq;
}
} preservecmp;
struct index_event {
@@ -1819,49 +1822,10 @@ mvt_tile assign_to_bins(mvt_tile &features,
std::set<std::string> exclude,
std::vector<std::string> exclude_prefix,
int buffer, std::vector<clipbbox> const &clipbboxes) {
std::vector<index_event> events;
key_pool key_pool;
if (bins.size() == 0) {
return mvt_tile();
}
// Index bins
for (size_t i = 0; i < bins.size(); i++) {
for (size_t j = 0; j < bins[i].features.size(); j++) {
long long xmin, ymin, xmax, ymax;
unsigned long long start, end;
get_bbox(bins[i].features[j].geometry, &xmin, &ymin, &xmax, &ymax, z, x, y, bins[i].detail());
get_quadkey_bounds(xmin, ymin, xmax, ymax, &start, &end);
events.emplace_back(start, index_event::ENTER, i, j, xmin, ymin, xmax, ymax);
events.emplace_back(end, index_event::EXIT, i, j, xmin, ymin, xmax, ymax);
}
}
std::map<unsigned long long, std::pair<size_t, size_t>> fid_to_feature;
// Index points
for (size_t i = 0; i < features.layers.size(); i++) {
for (size_t j = 0; j < features.layers[i].features.size(); j++) {
long long xmin, ymin, xmax, ymax;
unsigned long long start, end;
if (features.layers[i].features[j].geometry.size() > 0) {
if (features.layers[i].features[j].has_id) {
fid_to_feature.emplace(features.layers[i].features[j].id, std::make_pair(i, j));
}
get_bbox(features.layers[i].features[j].geometry, &xmin, &ymin, &xmax, &ymax, z, x, y, features.layers[i].detail());
get_quadkey_bounds(xmin, ymin, xmax, ymax, &start, &end);
events.emplace_back(start, index_event::CHECK, i, j, xmin, ymin, xmax, ymax);
}
}
}
std::sort(events.begin(), events.end());
std::set<active_bin> active;
mvt_layer outlayer;
outlayer.extent = bins[0].extent;
outlayer.version = 2;
@@ -1869,40 +1833,43 @@ mvt_tile assign_to_bins(mvt_tile &features,
std::vector<std::vector<tile_feature>> outfeatures;
for (auto &e : events) {
if (e.kind == index_event::ENTER) {
active_bin a(e.layer, e.feature);
a.xmin = e.xmin;
a.ymin = e.ymin;
a.xmax = e.xmax;
a.ymax = e.ymax;
const mvt_feature &bin = bins[e.layer].features[e.feature];
{
tile_feature outfeature;
for (auto const &g : bin.geometry) {
outfeature.geom.emplace_back(g.op, g.x, g.y);
if (bin_by_id_list.size() > 0) {
std::map<unsigned long long, std::pair<size_t, size_t>> fid_to_feature;
for (size_t i = 0; i < features.layers.size(); i++) {
for (size_t j = 0; j < features.layers[i].features.size(); j++) {
if (features.layers[i].features[j]->geometry.size() > 0) {
if (features.layers[i].features[j]->has_id) {
fid_to_feature.emplace(features.layers[i].features[j]->id, std::make_pair(i, j));
}
}
outfeature.t = bin.type;
outfeature.has_id = bin.has_id;
outfeature.id = bin.id;
outfeature.tags = bin.tags;
outfeature.layer = &bins[e.layer];
outfeature.seq = e.feature;
a.outfeature = outfeatures.size();
outfeatures.push_back({std::move(outfeature)});
}
}
if (bin_by_id_list.size() > 0) {
for (size_t k = 0; k < bin.tags.size(); k += 2) {
if (bins[e.layer].keys[bin.tags[k]] == bin_by_id_list) {
std::vector<size_t> ids = parse_ids_string(bins[e.layer].values[bin.tags[k + 1]]);
for (auto &binlayer : bins) {
size_t seq = 0;
for (auto &bin : binlayer.features) {
{
tile_feature outfeature;
for (auto const &g : bin->geometry) {
outfeature.geom.emplace_back(g.op, g.x, g.y);
}
outfeature.t = bin->type;
outfeature.has_id = bin->has_id;
outfeature.id = bin->id;
outfeature.tags = bin->tags;
outfeature.layer = &binlayer;
outfeature.seq = seq++;
outfeatures.push_back({std::move(outfeature)});
}
for (size_t k = 0; k < bin->tags.size(); k += 2) {
if (binlayer.keys[bin->tags[k]] == bin_by_id_list) {
std::vector<size_t> ids = parse_ids_string(binlayer.values[bin->tags[k + 1]]);
for (auto &id : ids) {
auto f = fid_to_feature.find(id);
if (f != fid_to_feature.end()) {
mvt_feature &feature = features.layers[f->second.first].features[f->second.second];
mvt_feature &feature = *features.layers[f->second.first].features[f->second.second];
if (feature.geometry.size() > 0) {
tile_feature outfeature;
for (auto const &g : feature.geometry) {
@@ -1913,8 +1880,8 @@ mvt_tile assign_to_bins(mvt_tile &features,
outfeature.has_id = feature.has_id;
outfeature.id = feature.id;
outfeature.tags = feature.tags;
outfeature.layer = &features.layers[e.layer];
outfeature.seq = e.feature;
outfeature.layer = &features.layers[f->second.first];
outfeature.seq = f->second.second;
outfeatures.back().push_back(std::move(outfeature));
}
}
@@ -1923,67 +1890,128 @@ mvt_tile assign_to_bins(mvt_tile &features,
}
}
}
}
} else {
std::vector<index_event> events;
active.insert(std::move(a));
} else if (e.kind == index_event::CHECK) {
if (bin_by_id_list.size() > 0) {
continue; // only bin by id, not geometrically
// Index bins
for (size_t i = 0; i < bins.size(); i++) {
for (size_t j = 0; j < bins[i].features.size(); j++) {
long long xmin, ymin, xmax, ymax;
unsigned long long start, end;
get_bbox(bins[i].features[j]->geometry, &xmin, &ymin, &xmax, &ymax, z, x, y, bins[i].detail());
get_quadkey_bounds(xmin, ymin, xmax, ymax, &start, &end);
events.emplace_back(start, index_event::ENTER, i, j, xmin, ymin, xmax, ymax);
events.emplace_back(end, index_event::EXIT, i, j, xmin, ymin, xmax, ymax);
}
}
auto const &feature = features.layers[e.layer].features[e.feature];
// Index points
for (size_t i = 0; i < features.layers.size(); i++) {
for (size_t j = 0; j < features.layers[i].features.size(); j++) {
long long xmin, ymin, xmax, ymax;
unsigned long long start, end;
if (feature.geometry.size() == 0) {
// already assigned by ID
continue;
if (features.layers[i].features[j]->geometry.size() > 0) {
get_bbox(features.layers[i].features[j]->geometry, &xmin, &ymin, &xmax, &ymax, z, x, y, features.layers[i].detail());
get_quadkey_bounds(xmin, ymin, xmax, ymax, &start, &end);
events.emplace_back(start, index_event::CHECK, i, j, xmin, ymin, xmax, ymax);
}
}
}
// if we can't find a real match,
// assign points to the most nearby bin
ssize_t which_outfeature = outfeatures.size() - 1;
std::sort(events.begin(), events.end());
std::set<active_bin> active;
for (auto const &a : active) {
auto const &bin = bins[a.layer].features[a.feature];
for (auto &e : events) {
if (e.kind == index_event::ENTER) {
active_bin a(e.layer, e.feature);
a.xmin = e.xmin;
a.ymin = e.ymin;
a.xmax = e.xmax;
a.ymax = e.ymax;
if (bbox_intersects(e.xmin, e.ymin, e.xmax, e.ymax,
a.xmin, a.ymin, a.xmax, a.ymax)) {
if (pnpoly_mp(bin.geometry, feature.geometry[0].x, feature.geometry[0].y)) {
which_outfeature = a.outfeature;
break;
const mvt_feature &bin = *bins[e.layer].features[e.feature];
{
tile_feature outfeature;
for (auto const &g : bin.geometry) {
outfeature.geom.emplace_back(g.op, g.x, g.y);
}
outfeature.t = bin.type;
outfeature.has_id = bin.has_id;
outfeature.id = bin.id;
outfeature.tags = bin.tags;
outfeature.layer = &bins[e.layer];
outfeature.seq = e.feature;
a.outfeature = outfeatures.size();
outfeatures.push_back({std::move(outfeature)});
}
active.insert(std::move(a));
} else if (e.kind == index_event::CHECK) {
if (bin_by_id_list.size() > 0) {
continue; // only bin by id, not geometrically
}
auto const &feature = *features.layers[e.layer].features[e.feature];
if (feature.geometry.size() == 0) {
// already assigned by ID
continue;
}
// if we can't find a real match,
// assign points to the most nearby bin
ssize_t which_outfeature = outfeatures.size() - 1;
for (auto const &a : active) {
auto const &bin = *bins[a.layer].features[a.feature];
if (bbox_intersects(e.xmin, e.ymin, e.xmax, e.ymax,
a.xmin, a.ymin, a.xmax, a.ymax)) {
if (pnpoly_mp(bin.geometry, feature.geometry[0].x, feature.geometry[0].y)) {
which_outfeature = a.outfeature;
break;
}
}
}
}
if (which_outfeature >= 0) {
tile_feature outfeature;
for (auto const &g : feature.geometry) {
outfeature.geom.emplace_back(g.op, g.x, g.y);
if (which_outfeature >= 0) {
tile_feature outfeature;
for (auto const &g : feature.geometry) {
outfeature.geom.emplace_back(g.op, g.x, g.y);
}
outfeature.t = feature.type;
outfeature.has_id = feature.has_id;
outfeature.id = feature.id;
outfeature.tags = feature.tags;
outfeature.layer = &features.layers[e.layer];
outfeature.seq = e.feature;
outfeatures[which_outfeature].push_back(std::move(outfeature));
}
} else /* EXIT */ {
auto const &found = active.find({e.layer, e.feature});
if (found != active.end()) {
active.erase(found);
} else {
fprintf(stderr, "event mismatch: can't happen\n");
exit(EXIT_IMPOSSIBLE);
}
outfeature.t = feature.type;
outfeature.has_id = feature.has_id;
outfeature.id = feature.id;
outfeature.tags = feature.tags;
outfeature.layer = &features.layers[e.layer];
outfeature.seq = e.feature;
outfeatures[which_outfeature].push_back(std::move(outfeature));
}
} else /* EXIT */ {
auto const &found = active.find({e.layer, e.feature});
if (found != active.end()) {
active.erase(found);
} else {
fprintf(stderr, "event mismatch: can't happen\n");
exit(EXIT_IMPOSSIBLE);
}
}
}
key_pool key_pool;
for (size_t i = 0; i < outfeatures.size(); i++) {
if (outfeatures[i].size() > 1) {
if (feature_out(outfeatures[i], outlayer,
keep, exclude, exclude_prefix, attribute_accum,
accumulate_numeric, key_pool, buffer, true,
clipbboxes, z, x, y, NULL)) {
mvt_feature &nfeature = outlayer.features.back();
mvt_feature &nfeature = *outlayer.features.back();
mvt_value val;
val.type = mvt_uint;
val.numeric_value.uint_value = outfeatures[i].size() - 1;
@@ -2069,7 +2097,8 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
static const std::string retain_points_multiplier_first = "tippecanoe:retain_points_multiplier_first";
static const std::string retain_points_multiplier_sequence = "tippecanoe:retain_points_multiplier_sequence";
for (auto feature : layer.features) {
for (auto feature_ref : layer.features) {
auto feature = *feature_ref; // this needs to be a copy, because tile-join still needs the original unmutated
drawvec geom;
int t = feature.type;
@@ -2543,6 +2572,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;
+3 -3
View File
@@ -60,11 +60,11 @@ void do_stats(mvt_tile &tile, size_t size, bool compressed, int z, unsigned x, u
size_t points = 0, lines = 0, polygons = 0;
for (size_t j = 0; j < tile.layers[i].features.size(); j++) {
if (tile.layers[i].features[j].type == mvt_point) {
if (tile.layers[i].features[j]->type == mvt_point) {
points++;
} else if (tile.layers[i].features[j].type == mvt_linestring) {
} else if (tile.layers[i].features[j]->type == mvt_linestring) {
lines++;
} else if (tile.layers[i].features[j].type == mvt_polygon) {
} else if (tile.layers[i].features[j]->type == mvt_polygon) {
polygons++;
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
sudo yum install git clang sqlite-devel zlib-devel
2. Create a ZIP archive with the `tippecanoe` binary at `bin/tippecanoe` and upload as a Lambda layer
3. Copy [lambda_function.py](lambda_function.py) (python 3.9 runtime)
3. Copy [tippecanoe.py](tippecanoe.py) (python 3.9 runtime)
4. set the environment variable `OUTPUT_BUCKET` to your output bucket; give lambda IAM role access to input/output buckets
5. Enable ACLs on the output bucket
+6 -6
View File
@@ -278,7 +278,7 @@ bool mvt_tile::decode(const std::string &message, bool &was_compressed) {
}
}
layer.features.push_back(std::move(feature));
layer.features.push_back(std::make_shared<mvt_feature>(feature));
break;
}
@@ -407,16 +407,16 @@ std::string mvt_tile::encode() {
std::string feature_string;
protozero::pbf_writer feature_writer(feature_string);
feature_writer.add_enum(3, layers[i].features[f].type);
feature_writer.add_enum(3, layers[i].features[f]->type);
std::vector<unsigned> sorted_tags = layers[i].features[f].tags;
std::vector<unsigned> sorted_tags = layers[i].features[f]->tags;
for (size_t v = 1; v < sorted_tags.size(); v += 2) {
sorted_tags[v] = mapping[sorted_tags[v]];
}
feature_writer.add_packed_uint32(2, std::begin(sorted_tags), std::end(sorted_tags));
if (layers[i].features[f].has_id) {
feature_writer.add_uint64(1, layers[i].features[f].id);
if (layers[i].features[f]->has_id) {
feature_writer.add_uint64(1, layers[i].features[f]->id);
}
std::vector<uint32_t> geometry;
@@ -426,7 +426,7 @@ std::string mvt_tile::encode() {
int cmd = -1;
int length = 0;
std::vector<mvt_geometry> &geom = layers[i].features[f].geometry;
std::vector<mvt_geometry> &geom = layers[i].features[f]->geometry;
for (size_t g = 0; g < geom.size(); g++) {
int op = geom[g].op;
+1 -1
View File
@@ -204,7 +204,7 @@ struct std::hash<mvt_value> {
struct mvt_layer {
int version = 0;
std::string name = "";
std::vector<mvt_feature> features{};
std::vector<std::shared_ptr<mvt_feature>> features{};
std::vector<std::string> keys{};
std::vector<mvt_value> values{};
long long extent = 0;
+6 -6
View File
@@ -119,17 +119,17 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
}
for (auto const &feature : layer.features) {
if (feature.type == mvt_point) {
if (feature->type == mvt_point) {
ts->second.points++;
} else if (feature.type == mvt_linestring) {
} else if (feature->type == mvt_linestring) {
ts->second.lines++;
} else if (feature.type == mvt_polygon) {
} else if (feature->type == mvt_polygon) {
ts->second.polygons++;
}
for (size_t i = 0; i + 1 < feature.tags.size(); i += 2) {
const std::string &key = layer.keys[feature.tags[i]];
const mvt_value &val = layer.values[feature.tags[i + 1]];
for (size_t i = 0; i + 1 < feature->tags.size(); i += 2) {
const std::string &key = layer.keys[feature->tags[i]];
const mvt_value &val = layer.values[feature->tags[i + 1]];
// Nulls can be excluded here because this is the postfilter
// and it is nearly time to create the vector representation
+1 -1
View File
@@ -398,7 +398,7 @@ std::vector<mvt_layer> parse_layers(FILE *fp, int z, unsigned x, unsigned y, int
}
}
l->second.features.push_back(feature);
l->second.features.push_back(std::make_shared<mvt_feature>(feature));
}
json_free(j);
@@ -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": [
+6 -6
View File
@@ -243,9 +243,9 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
// scaling up is safe while scaling down requires geometry cleaning.
for (size_t i = 0; i < outlayer.features.size(); i++) {
for (size_t j = 0; j < outlayer.features[i].geometry.size(); j++) {
outlayer.features[i].geometry[j].x = outlayer.features[i].geometry[j].x * layer.extent / outlayer.extent;
outlayer.features[i].geometry[j].y = outlayer.features[i].geometry[j].y * layer.extent / outlayer.extent;
for (size_t j = 0; j < outlayer.features[i]->geometry.size(); j++) {
outlayer.features[i]->geometry[j].x = outlayer.features[i]->geometry[j].x * layer.extent / outlayer.extent;
outlayer.features[i]->geometry[j].y = outlayer.features[i]->geometry[j].y * layer.extent / outlayer.extent;
}
}
@@ -261,7 +261,7 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
join_keys.resize(layer.features.size());
for (size_t f = 0; f < layer.features.size(); f++) {
mvt_feature &feat = layer.features[f];
mvt_feature &feat = *layer.features[f];
join_keys[f].type = mvt_no_such_key;
for (size_t t = 0; t + 1 < feat.tags.size(); t += 2) {
@@ -289,7 +289,7 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
bool features_added_to_layer = false;
for (size_t f = 0; f < layer.features.size(); f++) {
mvt_feature &feat = layer.features[f];
mvt_feature &feat = *layer.features[f];
std::set<std::string> exclude_attributes;
if (filter != NULL && !evaluate(feat, layer, filter, exclude_attributes, z, unidecode_data)) {
@@ -520,7 +520,7 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
features_added++;
features_added_to_layer = true;
outlayer.features.push_back(outfeature);
outlayer.features.push_back(std::make_shared<mvt_feature>(outfeature));
if (z < tilestats->second.minzoom) {
tilestats->second.minzoom = z;
+13 -5
View File
@@ -1354,7 +1354,7 @@ void *run_prefilter(void *v) {
}
decode_meta(sf, tmp_layer, tmp_feature);
tmp_layer.features.push_back(tmp_feature);
tmp_layer.features.push_back(std::make_shared<mvt_feature>(tmp_feature));
layer_to_geojson(tmp_layer, 0, 0, 0, false, true, false, true, sf.index, sf.seq, sf.extent, true, state, 0, std::set<std::string>());
}
@@ -2003,7 +2003,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 +2027,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 +2049,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++;
@@ -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
}
}
@@ -2579,7 +2587,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
add_tilestats(layer.name, z, layermaps, tiling_seg, layer_unmaps, "tippecanoe_feature_density", sv);
}
layer.features.push_back(std::move(feature));
layer.features.push_back(std::make_shared<mvt_feature>(feature));
layer_features[x] = std::make_shared<serial_feature>();
}
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.77.0"
#define VERSION "v2.78.0"
#endif
+1 -1
View File
@@ -270,7 +270,7 @@ void write_coords(json_writer &state, lonlat const &ll, double scale) {
void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y, bool comma, bool name, bool zoom, bool write_dropped, unsigned long long index, long long sequence, long long extent, bool complain, json_writer &state, double scale, std::set<std::string> const &include_attr) {
for (size_t f = 0; f < layer.features.size(); f++) {
mvt_feature const &feat = layer.features[f];
mvt_feature const &feat = *layer.features[f];
state.json_write_hash();
state.json_write_string("type");