mirror of
https://github.com/felt/tippecanoe.git
synced 2026-11-27 10:51:17 +01:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40bb4ff732 | ||
|
|
d891ca7289 | ||
|
|
bc3ef87c3f |
@@ -1,3 +1,23 @@
|
||||
# 2.60.0
|
||||
|
||||
* Fix bad interaction between --retain-points-multiplier and stopping early when the tile feature limit is reached
|
||||
* Fix another bad interaction between --retain-points-multiplier, dropping-as-needed, and variable depth tile pyramids
|
||||
* Add optional BUILD_INFO string to version
|
||||
* Reorder overzoom logic to clip before dealing with multiplier and filters
|
||||
* When --generate-variable-depth-tile-pyramid is in use, report the actual highest zoom generated as tileset maxzoom
|
||||
|
||||
# 2.59.0
|
||||
|
||||
* Correct `antimeridian_adjusted_bounds` latitude calculation when vertices extend beyond the edge of the Mercator plane
|
||||
|
||||
# 2.58.0
|
||||
|
||||
* Add --generate-variable-depth-tile-pyramid option
|
||||
* Add --line-simplification and --tiny-polygon-size options to tippecanoe-overzoom
|
||||
* Adjust tile feature limit for --retain-points-multiplier
|
||||
* Tune convergence rate for --coalesce-densest and --drop-densest
|
||||
* Fix overreported drop and coalesce counts in strategies
|
||||
|
||||
# 2.57.0
|
||||
|
||||
* Add multi-tile input to tippecanoe-overzoom
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
PREFIX ?= /usr/local
|
||||
MANDIR ?= $(PREFIX)/share/man/man1/
|
||||
BUILDTYPE ?= Release
|
||||
BUILD_INFO ?=
|
||||
SHELL = /bin/sh
|
||||
|
||||
|
||||
# inherit from env if set
|
||||
CC := $(CC)
|
||||
CXX := $(CXX)
|
||||
CFLAGS := $(CFLAGS) -fPIE
|
||||
CXXFLAGS := $(CXXFLAGS) -std=c++17 -fPIE
|
||||
CFLAGS := $(CFLAGS) -fPIE -DBUILD_INFO=$(BUILD_INFO)
|
||||
CXXFLAGS := $(CXXFLAGS) -std=c++17 -fPIE -DBUILD_INFO=$(BUILD_INFO)
|
||||
LDFLAGS := $(LDFLAGS)
|
||||
WARNING_FLAGS := -Wall -Wshadow -Wsign-compare -Wextra -Wunreachable-code -Wuninitialized -Wshadow
|
||||
RELEASE_FLAGS := -O3 -DNDEBUG
|
||||
|
||||
@@ -352,7 +352,7 @@ Parallel processing will also be automatic if the input file is in FlatGeobuf fo
|
||||
specified maximum zoom and to any levels added beyond that.
|
||||
* `--extend-zooms-if-still-dropping-maximum=`_count_: Increase the maxzoom if features are still being dropped at that zoom level
|
||||
by up to _count_ zoom levels.
|
||||
* `-at` or `--truncate-zooms`: Don't produce child tiles for any tile that should be sufficient to be overzoomed to any higher zoom level. Such tiles will be produced with maximum detail and no simplification. Tiles with point features below the basezoom or where any features have to be dropped dynamically, or which contain too many features or bytes with full detail, will be written out with normal detail and split into child tiles.
|
||||
* `-at` or `--generate-variable-depth-tile-pyramid`: Don't produce child tiles for any tile that should be sufficient to be overzoomed to any higher zoom level. Such tiles will be produced with maximum detail and no simplification or polygon cleaning. Tiles with point features below the basezoom or where any features have to be dropped dynamically, or which contain too many features or bytes with full detail, will be written out with normal detail and split into child tiles. Tilesets generated with this option are suitable for use only with tile servers that will find the appropriate tile to overzoom from and will simplify and clean the geometries appropriately before serving the tile.
|
||||
* `-R` _zoom_`/`_x_`/`_y_ or `--one-tile=`_zoom_`/`_x_`/`_y_: Set the minzoom and maxzoom to _zoom_ and produce only
|
||||
the single specified tile at that zoom level.
|
||||
|
||||
|
||||
@@ -1188,37 +1188,6 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
|
||||
static const std::string retain_points_multiplier_sequence = "tippecanoe:retain_points_multiplier_sequence";
|
||||
|
||||
for (auto feature : layer.features) {
|
||||
bool flush_multiplier_cluster = false;
|
||||
if (demultiply) {
|
||||
for (ssize_t i = feature.tags.size() - 2; i >= 0; i -= 2) {
|
||||
if (layer.keys[feature.tags[i]] == retain_points_multiplier_first) {
|
||||
mvt_value v = layer.values[feature.tags[i + 1]];
|
||||
if (v.type == mvt_bool && v.numeric_value.bool_value) {
|
||||
flush_multiplier_cluster = true;
|
||||
feature.tags.erase(feature.tags.begin() + i, feature.tags.begin() + i + 2);
|
||||
}
|
||||
} else if (i < (ssize_t) feature.tags.size() && layer.keys[feature.tags[i]] == retain_points_multiplier_sequence) {
|
||||
mvt_value v = layer.values[feature.tags[i + 1]];
|
||||
feature.seq = mvt_value_to_long_long(v);
|
||||
feature.tags.erase(feature.tags.begin() + i, feature.tags.begin() + i + 2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
flush_multiplier_cluster = true;
|
||||
}
|
||||
|
||||
if (flush_multiplier_cluster) {
|
||||
if (pending_tile_features.size() > 0) {
|
||||
feature_out(pending_tile_features, *outlayer, keep, attribute_accum, tile_stringpool);
|
||||
pending_tile_features.clear();
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> exclude_attributes;
|
||||
if (filter != NULL && !evaluate(feature, layer, filter, exclude_attributes, nz, unidecode_data)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
drawvec geom;
|
||||
int t = feature.type;
|
||||
|
||||
@@ -1268,6 +1237,7 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
|
||||
|
||||
long long b = outtilesize * buffer / 256;
|
||||
if (xmax < -b || ymax < -b || xmin > outtilesize + b || ymin > outtilesize + b) {
|
||||
// quick exclusion by bounding box
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1281,6 +1251,42 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
|
||||
}
|
||||
}
|
||||
|
||||
if (geom.size() == 0) {
|
||||
// clipped away
|
||||
continue;
|
||||
}
|
||||
|
||||
bool flush_multiplier_cluster = false;
|
||||
if (demultiply) {
|
||||
for (ssize_t i = feature.tags.size() - 2; i >= 0; i -= 2) {
|
||||
if (layer.keys[feature.tags[i]] == retain_points_multiplier_first) {
|
||||
mvt_value v = layer.values[feature.tags[i + 1]];
|
||||
if (v.type == mvt_bool && v.numeric_value.bool_value) {
|
||||
flush_multiplier_cluster = true;
|
||||
feature.tags.erase(feature.tags.begin() + i, feature.tags.begin() + i + 2);
|
||||
}
|
||||
} else if (i < (ssize_t) feature.tags.size() && layer.keys[feature.tags[i]] == retain_points_multiplier_sequence) {
|
||||
mvt_value v = layer.values[feature.tags[i + 1]];
|
||||
feature.seq = mvt_value_to_long_long(v);
|
||||
feature.tags.erase(feature.tags.begin() + i, feature.tags.begin() + i + 2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
flush_multiplier_cluster = true;
|
||||
}
|
||||
|
||||
if (flush_multiplier_cluster) {
|
||||
if (pending_tile_features.size() > 0) {
|
||||
feature_out(pending_tile_features, *outlayer, keep, attribute_accum, tile_stringpool);
|
||||
pending_tile_features.clear();
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> exclude_attributes;
|
||||
if (filter != NULL && !evaluate(feature, layer, filter, exclude_attributes, nz, unidecode_data)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool still_need_simplification_after_reduction = false;
|
||||
if (t == VT_POLYGON && tiny_polygon_size > 0) {
|
||||
bool simplified_away_by_reduction = false;
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include "tile.hpp"
|
||||
#include "pool.hpp"
|
||||
#include "projection.hpp"
|
||||
#include "version.hpp"
|
||||
#include "memfile.hpp"
|
||||
#include "main.hpp"
|
||||
#include "geojson.hpp"
|
||||
@@ -3067,7 +3066,7 @@ int main(int argc, char **argv) {
|
||||
{"smallest-maximum-zoom-guess", required_argument, 0, '~'},
|
||||
{"extend-zooms-if-still-dropping", no_argument, &additional[A_EXTEND_ZOOMS], 1},
|
||||
{"extend-zooms-if-still-dropping-maximum", required_argument, 0, '~'},
|
||||
{"truncate-zooms", no_argument, &additional[A_TRUNCATE_ZOOMS], 1},
|
||||
{"generate-variable-depth-tile-pyramid", no_argument, &additional[A_VARIABLE_DEPTH_PYRAMID], 1},
|
||||
{"one-tile", required_argument, 0, 'R'},
|
||||
|
||||
{"Tile resolution", 0, 0, 0},
|
||||
@@ -3608,7 +3607,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
case 'v':
|
||||
fprintf(stderr, "tippecanoe %s\n", VERSION);
|
||||
fprintf(stderr, "tippecanoe %s\n", version_str().c_str());
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
case 'P':
|
||||
|
||||
+1
-1
@@ -416,7 +416,7 @@ specified maximum zoom and to any levels added beyond that.
|
||||
\fB\fC\-\-extend\-zooms\-if\-still\-dropping\-maximum=\fR\fIcount\fP: Increase the maxzoom if features are still being dropped at that zoom level
|
||||
by up to \fIcount\fP zoom levels.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-at\fR or \fB\fC\-\-truncate\-zooms\fR: Don't produce child tiles for any tile that should be sufficient to be overzoomed to any higher zoom level. Such tiles will be produced with maximum detail and no simplification. Tiles with point features below the basezoom or where any features have to be dropped dynamically, or which contain too many features or bytes with full detail, will be written out with normal detail and split into child tiles.
|
||||
\fB\fC\-at\fR or \fB\fC\-\-generate\-variable\-depth\-tile\-pyramid\fR: Don't produce child tiles for any tile that should be sufficient to be overzoomed to any higher zoom level. Such tiles will be produced with maximum detail and no simplification or polygon cleaning. Tiles with point features below the basezoom or where any features have to be dropped dynamically, or which contain too many features or bytes with full detail, will be written out with normal detail and split into child tiles. Tilesets generated with this option are suitable for use only with tile servers that will find the appropriate tile to overzoom from and will simplify and clean the geometries appropriately before serving the tile.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-R\fR \fIzoom\fP\fB\fC/\fR\fIx\fP\fB\fC/\fR\fIy\fP or \fB\fC\-\-one\-tile=\fR\fIzoom\fP\fB\fC/\fR\fIx\fP\fB\fC/\fR\fIy\fP: Set the minzoom and maxzoom to \fIzoom\fP and produce only
|
||||
the single specified tile at that zoom level.
|
||||
|
||||
+20
-1
@@ -444,6 +444,14 @@ std::string stringify_strategies(std::vector<strategy> const &strategies) {
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (strategies[i].truncated_zooms > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("truncated_zooms");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].truncated_zooms);
|
||||
any = true;
|
||||
}
|
||||
|
||||
state.nospace = true;
|
||||
state.json_end_hash();
|
||||
}
|
||||
@@ -646,6 +654,17 @@ static double sixdig(double val) {
|
||||
return std::round(val * 1e6) / 1e6;
|
||||
}
|
||||
|
||||
#define str(x) #x
|
||||
#define xstr(x) str(x)
|
||||
std::string version_str() {
|
||||
std::string s = VERSION;
|
||||
std::string build_info = xstr(BUILD_INFO);
|
||||
if (build_info.size() > 0) {
|
||||
s += " " + build_info;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double minlat2, double minlon2, double maxlat2, double maxlon2, double midlat, double midlon, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies, int basezoom, double droprate, int retain_points_multiplier) {
|
||||
metadata m;
|
||||
|
||||
@@ -676,7 +695,7 @@ metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minla
|
||||
m.attribution = attribution;
|
||||
}
|
||||
|
||||
m.generator = program + " " + VERSION;
|
||||
m.generator = program + " " + version_str();
|
||||
m.generator_options = commandline;
|
||||
|
||||
m.strategies_json = stringify_strategies(strategies);
|
||||
|
||||
@@ -77,5 +77,6 @@ std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::
|
||||
std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::string, layermap_entry> > const &maps, bool trunc);
|
||||
|
||||
void add_to_tilestats(std::map<std::string, tilestat> &tilestats, std::string const &layername, serial_val const &val);
|
||||
std::string version_str();
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
#define A_HILBERT ((int) 'h')
|
||||
#define A_VISVALINGAM ((int) 'v')
|
||||
#define A_GENERATE_POLYGON_LABEL_POINTS ((int) 'P')
|
||||
#define A_TRUNCATE_ZOOMS ((int) 't')
|
||||
#define A_VARIABLE_DEPTH_PYRAMID ((int) 't')
|
||||
|
||||
#define P_SIMPLIFY ((int) 's')
|
||||
#define P_SIMPLIFY_LOW ((int) 'S')
|
||||
|
||||
+7
-4
@@ -423,12 +423,15 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf, std::
|
||||
|
||||
for (size_t i = 0; i < sf.geometry.size(); i++) {
|
||||
if (sf.geometry[i].op == VT_MOVETO || sf.geometry[i].op == VT_LINETO) {
|
||||
if (sf.geometry[i].y > 0 && sf.geometry[i].y < 0xFFFFFFFF) {
|
||||
// standard -180 to 180 world plane
|
||||
// standard -180 to 180 world plane
|
||||
//
|
||||
// mask X, since it wraps around
|
||||
// pin Y, since it doesn't
|
||||
|
||||
long long x = sf.geometry[i].x & 0xFFFFFFFF;
|
||||
long long y = sf.geometry[i].y & 0xFFFFFFFF;
|
||||
long long x = sf.geometry[i].x & 0xFFFFFFFF;
|
||||
long long y = std::max(std::min(sf.geometry[i].y, 0xFFFFFFFFLL), 0LL);
|
||||
|
||||
{
|
||||
r->file_bbox1[0] = std::min(r->file_bbox1[0], x);
|
||||
r->file_bbox1[1] = std::min(r->file_bbox1[1], y);
|
||||
r->file_bbox1[2] = std::max(r->file_bbox1[2], x);
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
|
||||
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
|
||||
"bounds": "-179.320808,-85.051129,177.449262,85.051129",
|
||||
"center": "-179.320808,-69.033211,14",
|
||||
"description": "tests/accumulate/out/--set-attribute_thecomma%3aNEWVALUE_--accumulate-attribute_thecomma%3acomma.json.check.mbtiles",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
|
||||
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
|
||||
"bounds": "-179.320808,-85.051129,177.449262,85.051129",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/accumulate/out/-z0_--set-attribute_%7b%22num%22%3a5,%22str%22%3a%22abc%22}.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
|
||||
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
|
||||
"bounds": "-179.320808,-85.051129,177.449262,85.051129",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/accumulate/out/-z0_--set-attribute_num%3a5_--set-attribute_str%3aabc.json.check.mbtiles",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
|
||||
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
|
||||
"bounds": "-179.320808,-85.051129,177.449262,85.051129",
|
||||
"center": "-157.500000,20.489949,3",
|
||||
"description": "tests/accumulate/out/-z3_--accumulate-attribute_%7b%22thesum%22%3a%22sum%22,%22theproduct%22%3a%22product%22}.json.check.mbtiles",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
|
||||
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
|
||||
"bounds": "-179.320808,-85.051129,177.449262,85.051129",
|
||||
"center": "112.500000,20.489949,3",
|
||||
"description": "tests/accumulate/out/-z3_-Ethesum%3asum_-Etheproduct%3aproduct_-Ethemax%3amax_-Ethemin%3amin_-Ethemean%3amean_-Etheconcat%3aconcat_-Ethecomma%3acomma_-r1_-K100.json.check.mbtiles",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
|
||||
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
|
||||
"bounds": "-179.320808,-85.051129,177.449262,85.051129",
|
||||
"center": "-174.375000,-52.349536,5",
|
||||
"description": "tests/accumulate/out/-z5_-Ethesum%3asum_-Etheproduct%3aproduct_-Ethemax%3amax_-Ethemin%3amin_-Ethemean%3amean_-Etheconcat%3aconcat_-Ethecomma%3acomma.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023803,-85.040752,359.950215,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023803,-85.051129,359.950215,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "90.000000,42.525564,1",
|
||||
"description": "tests/coalesce-id/out/-z1_--coalesce_--reorder.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "-175.220564,-41.299988,179.216647,64.150024",
|
||||
"antimeridian_adjusted_bounds": "-175.220564,-41.299988,179.216647,85.051129",
|
||||
"bounds": "-180.000000,-41.299988,180.000000,85.051129",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/csv/out-null.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "-175.220564,-41.299988,179.216647,64.150024",
|
||||
"antimeridian_adjusted_bounds": "-175.220564,-41.299988,179.216647,85.051129",
|
||||
"bounds": "-180.000000,-41.299988,180.000000,85.051129",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/csv/out.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "180.000000,85.051129,-180.000000,-85.051129",
|
||||
"antimeridian_adjusted_bounds": "-135.232962,-85.051129,-135.232962,-85.051129",
|
||||
"bounds": "-135.232962,-85.051129,-135.232962,-85.051129",
|
||||
"center": "-135.232962,-85.051129,0",
|
||||
"description": "tests/invalid-polygon/out/-z0.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "180.000000,85.051129,-180.000000,-85.051129",
|
||||
"antimeridian_adjusted_bounds": "0.000000,-85.051129,0.000000,-85.051129",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,-85.051129",
|
||||
"center": "0.000000,-85.051129,0",
|
||||
"format": "pbf",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/loop/out/-z0_-O200_--cluster-densest-as-needed.json.check.mbtiles",
|
||||
"strategies": "[{\"coalesced_as_needed\":999,\"feature_count_desired\":201}]",
|
||||
"strategies": "[{\"coalesced_as_needed\":999,\"feature_count_desired\":1000}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/loop/out/-z0_-O200_--drop-densest-as-needed.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_as_needed\":999,\"feature_count_desired\":201}]",
|
||||
"strategies": "[{\"dropped_as_needed\":999,\"feature_count_desired\":1000}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/loop/out/-z0_-O200_--drop-fraction-as-needed.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_as_needed\":999,\"feature_count_desired\":201}]",
|
||||
"strategies": "[{\"dropped_as_needed\":999,\"feature_count_desired\":1000}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
File diff suppressed because one or more lines are too long
+8958
-7768
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "45.000000,33.256630,2",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/--coalesce_-z2_-Ccat.json.check.mbtiles",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-B10_-z0_--retain-points-multiplier_10_-d8_-yNAME.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "16.875000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-R5%2f17%2f11.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "16.875000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--drop-densest-as-needed.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "16.875000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--drop-fraction-as-needed.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "16.875000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--drop-smallest-as-needed.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "16.875000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--force-feature-limit.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-110.039063,26.980829,-92.021484,51.998410",
|
||||
"center": "-92.021484,26.980829,0",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z0_--clip-bounding-box_-110,27,-92,52.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z0_--order-largest-first.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z0_--order-smallest-first.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z0_--tiny-polygon-size_100.json.check.mbtiles",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z0_--tiny-polygon-size_50_--order-largest-first.json.check.mbtiles",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z0_--tiny-polygon-size_50_--simplification_50.json.check.mbtiles",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "90.000000,42.525564,1",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z1_-yname_--no-simplification-of-shared-nodes.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "45.000000,33.256630,2",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z2_--convert-polygons-to-label-points.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "22.500000,20.489949,3",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z3_-ai.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "11.250000,48.378236,4",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z4_-yname.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "11.250000,48.378236,4",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z4_-yname_--drop-polygons.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "11.250000,48.378236,4",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z4_-yname_--grid-low-zooms_-D8.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "11.250000,48.378236,4",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z4_-yname_--no-tiny-polygon-reduction.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "11.250000,48.378236,4",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-S4.json.check.mbtiles",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "11.250000,48.378236,4",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-S4_--simplification-at-maximum-zoom_2.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "11.250000,48.378236,4",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-S4_--visvalingam.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "-101.250000,70.266402,4",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-pD.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "11.250000,48.378236,4",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-pc.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "16.875000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z5_-M5000_--coalesce-densest-as-needed.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "16.875000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z5_-M5000_--coalesce-fraction-as-needed.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "16.875000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z5_-M5000_--coalesce-smallest-as-needed.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "16.875000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-z5_-M5000_--drop-smallest-as-needed.json.check.mbtiles",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.040752,359.950216,83.645130",
|
||||
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
|
||||
"bounds": "-180.000000,-85.051129,180.000000,83.645130",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/ne_110m_admin_0_countries/out/-zg_-yname.json.check.mbtiles",
|
||||
|
||||
+7
-6
File diff suppressed because one or more lines are too long
@@ -1,14 +1,15 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "180.000000,85.051129,-180.000000,-85.051129",
|
||||
"antimeridian_adjusted_bounds": "0.000000,85.051129,0.000000,85.051129",
|
||||
"bounds": "-180.000000,85.051129,180.000000,85.051129",
|
||||
"center": "-179.989014,85.051129,14",
|
||||
"center": "0.000000,85.051129,0",
|
||||
"description": "tests/raw-tiles/nothing",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -f -e tests/raw-tiles/nothing tests/raw-tiles/nothing.geojson",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"nothing\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":14,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"nothing\",\"count\":1,\"geometry\":\"Point\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "14",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"nothing\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"nothing\",\"count\":1,\"geometry\":\"Point\",\"attributeCount\":0,\"attributes\":[]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/raw-tiles/nothing",
|
||||
"tippecanoe_decisions": "{\"basezoom\":14,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+8
-7
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "-180.000000,12.583700,179.688000,85.027900",
|
||||
"antimeridian_adjusted_bounds": "-180.000000,12.583700,179.688000,85.051129",
|
||||
"bounds": "-180.000000,12.583700,180.000000,85.051129",
|
||||
"center": "0.000000,12.583700,0",
|
||||
"description": "tests/wraparound2/out/-z0_--detect-longitude-wraparound.json.check.mbtiles",
|
||||
|
||||
@@ -877,6 +877,8 @@ void handle_strategies(const unsigned char *s, std::vector<strategy> *st) {
|
||||
(*st)[i].dropped_as_needed += v->value.number.number;
|
||||
} else if (strcmp(k->value.string.string, "coalesced_as_needed") == 0) {
|
||||
(*st)[i].coalesced_as_needed += v->value.number.number;
|
||||
} else if (strcmp(k->value.string.string, "truncated_zooms") == 0) {
|
||||
(*st)[i].truncated_zooms += v->value.number.number;
|
||||
} else if (strcmp(k->value.string.string, "detail_reduced") == 0) {
|
||||
(*st)[i].detail_reduced += v->value.number.number;
|
||||
} else if (strcmp(k->value.string.string, "tiny_polygons") == 0) {
|
||||
|
||||
@@ -66,6 +66,7 @@ extern "C" {
|
||||
|
||||
pthread_mutex_t db_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_mutex_t var_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_mutex_t task_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
// convert serial feature geometry (drawvec) to output tile geometry (mvt_geometry)
|
||||
static std::vector<mvt_geometry> to_feature(drawvec const &geom) {
|
||||
@@ -833,6 +834,15 @@ static unsigned long long calculate_drop_sequence(serial_feature const &sf) {
|
||||
return ~out; // lowest numbered feature gets dropped first
|
||||
}
|
||||
|
||||
struct task {
|
||||
int fileno = 0;
|
||||
size_t todo;
|
||||
|
||||
bool operator<(const struct task &o) const {
|
||||
return todo < o.todo;
|
||||
}
|
||||
};
|
||||
|
||||
// This is the block of parameters that are passed to write_tile() to read a tile
|
||||
// from the serialized form, do whatever needs to be done to it, and to write the
|
||||
// MVT-format output to the output tileset.
|
||||
@@ -841,7 +851,8 @@ static unsigned long long calculate_drop_sequence(serial_feature const &sf) {
|
||||
// by the caller to determine whether the zoom level needs to be done over with
|
||||
// new thresholds.
|
||||
struct write_tile_args {
|
||||
struct task *tasks = NULL;
|
||||
int threadno;
|
||||
std::vector<task *> *tasks;
|
||||
char *global_stringpool = NULL;
|
||||
int min_detail = 0;
|
||||
sqlite3 *outdb = NULL;
|
||||
@@ -1514,6 +1525,7 @@ bool drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer_features
|
||||
ssize_t which_serial_feature;
|
||||
|
||||
if (find_feature_to_accumulate_onto(layer.features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
|
||||
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
|
||||
// so do that instead of dropping it
|
||||
@@ -1521,7 +1533,6 @@ bool drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer_features
|
||||
return false; // converted rather than dropped
|
||||
} else {
|
||||
preserve_attributes(attribute_accum, sf, layer.features[which_serial_feature]);
|
||||
strategy.dropped_as_needed++;
|
||||
drop_rest = true;
|
||||
return true; // dropped
|
||||
}
|
||||
@@ -1571,15 +1582,14 @@ 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_TRUNCATE_ZOOMS]) {
|
||||
if (additional[A_VARIABLE_DEPTH_PYRAMID]) {
|
||||
// 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.
|
||||
|
||||
// empirical estimate from ne_10m_admin_0_countries, CPAD units, Cal fires.
|
||||
// only try to make an overzoomable final tile if it seems like it might work
|
||||
long long estimated_output_tile_size = 0.6693 * estimated_complexity - 3.36e+04;
|
||||
|
||||
if (estimated_output_tile_size < (long long) (0.9 * max_tile_size)) {
|
||||
if (estimated_output_tile_size < (long long) (0.9 * max_tile_size) && 30 - z > detail) {
|
||||
first_detail = 30 - z;
|
||||
second_detail = detail;
|
||||
trying_to_stop_early = true;
|
||||
@@ -1629,6 +1639,9 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
size_t lead_features_count = 0; // of the tile so far
|
||||
size_t other_multiplier_cluster_features_count = 0; // of the tile so far
|
||||
|
||||
bool too_many_features = false;
|
||||
bool too_many_bytes = false;
|
||||
|
||||
std::atomic<bool> within[child_shards];
|
||||
long long start_geompos[child_shards];
|
||||
for (size_t i = 0; i < (size_t) child_shards; i++) {
|
||||
@@ -1856,8 +1869,8 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
} else if (additional[A_DROP_DENSEST_AS_NEEDED]) {
|
||||
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)) {
|
||||
can_stop_early = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -1901,8 +1914,8 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
// search here is for LLONG_MAX, not minextent, because we are dropping features, not coalescing them,
|
||||
// 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)) {
|
||||
can_stop_early = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -1920,11 +1933,9 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
}
|
||||
} else if (additional[A_DROP_FRACTION_AS_NEEDED] || prevent[P_DYNAMIC_DROP]) {
|
||||
add_sample_to(drop_sequences, drop_sequence, drop_sequences_increment, seq);
|
||||
// search here is for LLONG_MAX, not minextent, because we are dropping features, not coalescing them,
|
||||
// so we shouldn't expect to find anything small that we can related this feature to.
|
||||
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)) {
|
||||
can_stop_early = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -1984,10 +1995,42 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
unsigned long long sfindex = sf.index;
|
||||
|
||||
if (sf.geometry.size() > 0) {
|
||||
if (lead_features_count > max_tile_size || (lead_features_count + other_multiplier_cluster_features_count > max_tile_features && !prevent[P_FEATURE_LIMIT])) {
|
||||
// There are two adjustments that we need to make
|
||||
// when determining if we have hit the feature count
|
||||
// or byte size limit:
|
||||
//
|
||||
// The max_tile_size and max_tile_features are inflated
|
||||
// to account for the number of multiplier clusters features
|
||||
// we are carrying around in addition to their lead features.
|
||||
|
||||
size_t adjusted_max_tile_size = max_tile_size;
|
||||
if (lead_features_count > 0) {
|
||||
adjusted_max_tile_size = adjusted_max_tile_size * (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
||||
}
|
||||
size_t adjusted_max_tile_features = max_tile_features;
|
||||
if (lead_features_count > 0) {
|
||||
adjusted_max_tile_features = adjusted_max_tile_features * (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
||||
}
|
||||
|
||||
// The number of features in the tile, meanwhile, is inflated
|
||||
// to account for the number of features that we have skipped over
|
||||
// because we were already over the limit, in addition to those
|
||||
// that we have actually added to the layer (as either lead or
|
||||
// multiplier features).
|
||||
|
||||
size_t adjusted_feature_count = lead_features_count + other_multiplier_cluster_features_count;
|
||||
if (kept > 0) {
|
||||
adjusted_feature_count = adjusted_feature_count * (skipped + kept) / kept;
|
||||
}
|
||||
|
||||
if (too_many_bytes || adjusted_feature_count > adjusted_max_tile_size) {
|
||||
// Even being maximally conservative, each feature is still going to be
|
||||
// at least one byte in the output tile, so this can't possibly work.
|
||||
skipped++;
|
||||
too_many_bytes = true;
|
||||
} else if (too_many_features || ((adjusted_feature_count > adjusted_max_tile_features) && !prevent[P_FEATURE_LIMIT])) {
|
||||
skipped++;
|
||||
too_many_features = true;
|
||||
} else {
|
||||
kept++;
|
||||
|
||||
@@ -2110,7 +2153,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
geomfile[j]->end(&geompos[j], fname);
|
||||
within[j] = false;
|
||||
|
||||
if (additional[A_TRUNCATE_ZOOMS]) {
|
||||
if (additional[A_VARIABLE_DEPTH_PYRAMID]) {
|
||||
fflush(geomfile[j]->fp);
|
||||
if (pwrite(fileno(geomfile[j]->fp), &estimated_complexity_out, sizeof(estimated_complexity_out), start_geompos[j]) != sizeof(estimated_complexity_out)) {
|
||||
perror("pwrite complexity");
|
||||
@@ -2123,13 +2166,13 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
first_time = false;
|
||||
|
||||
// Adjust tile size limit based on the ratio of multiplier cluster features to lead features
|
||||
size_t scaled_max_tile_size = max_tile_size;
|
||||
size_t adjusted_max_tile_size = max_tile_size;
|
||||
if (lead_features_count > 0) {
|
||||
scaled_max_tile_size *= (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
||||
adjusted_max_tile_size = adjusted_max_tile_size * (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
||||
}
|
||||
size_t scaled_max_tile_features = max_tile_features;
|
||||
size_t adjusted_max_tile_features = max_tile_features;
|
||||
if (lead_features_count > 0) {
|
||||
scaled_max_tile_features *= (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
||||
adjusted_max_tile_features = adjusted_max_tile_features * (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
||||
}
|
||||
|
||||
// Operations on the features within each layer:
|
||||
@@ -2376,11 +2419,11 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
}
|
||||
|
||||
mvt_tile tile;
|
||||
size_t totalsize = 0;
|
||||
size_t feature_count = 0;
|
||||
|
||||
for (auto layer_iterator = layers.begin(); layer_iterator != layers.end(); ++layer_iterator) {
|
||||
std::vector<serial_feature> &layer_features = layer_iterator->second.features;
|
||||
totalsize += layer_features.size();
|
||||
feature_count += layer_features.size();
|
||||
|
||||
mvt_layer layer;
|
||||
layer.name = layer_iterator->first;
|
||||
@@ -2471,14 +2514,23 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
continue;
|
||||
}
|
||||
|
||||
if (totalsize > 0 && tile.layers.size() > 0) {
|
||||
if (totalsize > scaled_max_tile_features && !prevent[P_FEATURE_LIMIT]) {
|
||||
if (totalsize > arg->feature_count_out) {
|
||||
arg->feature_count_out = totalsize;
|
||||
// Again, adjust the retabulated feature count to estimate
|
||||
// how many total features there would have been if we hadn't
|
||||
// hit the limit and started dropping early.
|
||||
|
||||
size_t adjusted_feature_count = feature_count;
|
||||
if (kept > 0) {
|
||||
adjusted_feature_count = adjusted_feature_count * (skipped + kept) / kept;
|
||||
}
|
||||
|
||||
if (adjusted_feature_count > 0 && tile.layers.size() > 0) {
|
||||
if (too_many_features || (adjusted_feature_count > adjusted_max_tile_features && !prevent[P_FEATURE_LIMIT])) {
|
||||
if (adjusted_feature_count > arg->feature_count_out) {
|
||||
arg->feature_count_out = adjusted_feature_count;
|
||||
}
|
||||
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "tile %d/%u/%u has %zu features, >%zu \n", z, tx, ty, totalsize, scaled_max_tile_features);
|
||||
fprintf(stderr, "tile %d/%u/%u has %zu (estimated %zu) features, >%zu \n", z, tx, ty, feature_count, adjusted_feature_count, adjusted_max_tile_features);
|
||||
}
|
||||
|
||||
if (trying_to_stop_early && line_detail == first_detail) {
|
||||
@@ -2504,7 +2556,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
line_detail++; // to keep it the same when the loop decrements it
|
||||
continue;
|
||||
} else if (mingap < ULONG_MAX && (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED])) {
|
||||
mingap_fraction = mingap_fraction * scaled_max_tile_features / totalsize * 0.80;
|
||||
mingap_fraction = mingap_fraction * adjusted_max_tile_features / adjusted_feature_count * 0.80;
|
||||
unsigned long long m = choose_mingap(gaps, mingap_fraction, mingap);
|
||||
if (m != mingap) {
|
||||
mingap = m;
|
||||
@@ -2519,7 +2571,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
continue;
|
||||
}
|
||||
} else if (additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
|
||||
minextent_fraction = minextent_fraction * scaled_max_tile_features / totalsize * 0.75;
|
||||
minextent_fraction = minextent_fraction * adjusted_max_tile_features / adjusted_feature_count * 0.75;
|
||||
long long m = choose_minextent(extents, minextent_fraction, minextent);
|
||||
if (m != minextent) {
|
||||
minextent = m;
|
||||
@@ -2533,11 +2585,11 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
line_detail++;
|
||||
continue;
|
||||
}
|
||||
} else if (totalsize > layers.size() && (additional[A_DROP_FRACTION_AS_NEEDED] || additional[A_COALESCE_FRACTION_AS_NEEDED] || prevent[P_DYNAMIC_DROP])) {
|
||||
} else if (feature_count > layers.size() && (additional[A_DROP_FRACTION_AS_NEEDED] || additional[A_COALESCE_FRACTION_AS_NEEDED] || prevent[P_DYNAMIC_DROP])) {
|
||||
// The 95% is a guess to avoid too many retries
|
||||
// and probably actually varies based on how much duplicated metadata there is
|
||||
|
||||
mindrop_sequence_fraction = mindrop_sequence_fraction * scaled_max_tile_features / totalsize * 0.95;
|
||||
mindrop_sequence_fraction = mindrop_sequence_fraction * adjusted_max_tile_features / adjusted_feature_count * 0.95;
|
||||
unsigned long long m = choose_mindrop_sequence(drop_sequences, mindrop_sequence_fraction, mindrop_sequence);
|
||||
if (m != mindrop_sequence) {
|
||||
mindrop_sequence = m;
|
||||
@@ -2570,26 +2622,24 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
compressed = pbf;
|
||||
}
|
||||
|
||||
if (trying_to_stop_early && line_detail == first_detail) {
|
||||
// printf("%lld %zu\n", estimated_complexity, compressed.size());
|
||||
// And similarly, adjust the compressed byte size to estimate
|
||||
// what it would have been if we hadn't stopped dropping features early
|
||||
|
||||
size_t adjusted_tile_size = compressed.size();
|
||||
if (kept > 0) {
|
||||
adjusted_tile_size = adjusted_tile_size * (kept + skipped) / kept;
|
||||
}
|
||||
|
||||
if (compressed.size() > scaled_max_tile_size && !prevent[P_KILOBYTE_LIMIT]) {
|
||||
// Estimate how big it really should have been compressed
|
||||
// from how many features were kept vs skipped for already being
|
||||
// over the threshold
|
||||
|
||||
double kept_adjust = (skipped + kept) / (double) kept;
|
||||
|
||||
if (compressed.size() > arg->tile_size_out) {
|
||||
arg->tile_size_out = compressed.size() * kept_adjust;
|
||||
if (too_many_bytes || (adjusted_tile_size > adjusted_max_tile_size && !prevent[P_KILOBYTE_LIMIT])) {
|
||||
if (adjusted_tile_size > arg->tile_size_out) {
|
||||
arg->tile_size_out = adjusted_tile_size;
|
||||
}
|
||||
|
||||
if (!quiet) {
|
||||
if (skipped > 0) {
|
||||
fprintf(stderr, "tile %d/%u/%u size is %lld (probably really %lld) with detail %d, >%zu \n", z, tx, ty, (long long) compressed.size(), (long long) (compressed.size() * kept_adjust), line_detail, scaled_max_tile_size);
|
||||
if (adjusted_tile_size == compressed.size()) {
|
||||
fprintf(stderr, "tile %d/%u/%u size is %lld (probably really %zu) with detail %d, >%zu \n", z, tx, ty, (long long) compressed.size(), adjusted_tile_size, line_detail, adjusted_max_tile_size);
|
||||
} else {
|
||||
fprintf(stderr, "tile %d/%u/%u size is %lld with detail %d, >%zu \n", z, tx, ty, (long long) compressed.size(), line_detail, scaled_max_tile_size);
|
||||
fprintf(stderr, "tile %d/%u/%u size is %lld with detail %d, >%zu \n", z, tx, ty, (long long) compressed.size(), line_detail, adjusted_max_tile_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2616,7 +2666,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
}
|
||||
line_detail++; // to keep it the same when the loop decrements it
|
||||
} else if (mingap < ULONG_MAX && (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED])) {
|
||||
mingap_fraction = mingap_fraction * scaled_max_tile_size / (kept_adjust * compressed.size()) * 0.80;
|
||||
mingap_fraction = mingap_fraction * adjusted_max_tile_size / adjusted_tile_size * 0.80;
|
||||
unsigned long long m = choose_mingap(gaps, mingap_fraction, mingap);
|
||||
if (m != mingap) {
|
||||
mingap = m;
|
||||
@@ -2631,7 +2681,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
continue;
|
||||
}
|
||||
} else if (additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
|
||||
minextent_fraction = minextent_fraction * scaled_max_tile_size / (kept_adjust * compressed.size()) * 0.75;
|
||||
minextent_fraction = minextent_fraction * adjusted_max_tile_size / adjusted_tile_size * 0.75;
|
||||
long long m = choose_minextent(extents, minextent_fraction, minextent);
|
||||
if (m != minextent) {
|
||||
minextent = m;
|
||||
@@ -2645,8 +2695,8 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
line_detail++;
|
||||
continue;
|
||||
}
|
||||
} else if (totalsize > layers.size() && (additional[A_DROP_FRACTION_AS_NEEDED] || additional[A_COALESCE_FRACTION_AS_NEEDED] || prevent[P_DYNAMIC_DROP])) {
|
||||
mindrop_sequence_fraction = mindrop_sequence_fraction * scaled_max_tile_size / (kept_adjust * compressed.size()) * 0.75;
|
||||
} else if (feature_count > layers.size() && (additional[A_DROP_FRACTION_AS_NEEDED] || additional[A_COALESCE_FRACTION_AS_NEEDED] || prevent[P_DYNAMIC_DROP])) {
|
||||
mindrop_sequence_fraction = mindrop_sequence_fraction * adjusted_max_tile_size / adjusted_tile_size * 0.75;
|
||||
unsigned long long m = choose_mindrop_sequence(drop_sequences, mindrop_sequence_fraction, mindrop_sequence);
|
||||
if (m != mindrop_sequence) {
|
||||
mindrop_sequence = m;
|
||||
@@ -2671,6 +2721,11 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
|
||||
if (skipped > 0 || too_many_bytes || too_many_features) {
|
||||
fprintf(stderr, "Can't happen: writing tile even though we skipped\n");
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (outdb != NULL) {
|
||||
mbtiles_write_tile(outdb, z, tx, ty, compressed.data(), compressed.size());
|
||||
} else if (outdir != NULL) {
|
||||
@@ -2686,6 +2741,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
// We succeeded in stopping early.
|
||||
// Prune the child tiles.
|
||||
|
||||
strategy.truncated_zooms++;
|
||||
skip_children_out.insert(zxy(z, tx, ty));
|
||||
}
|
||||
|
||||
@@ -2702,17 +2758,35 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct task {
|
||||
int fileno = 0;
|
||||
struct task *next = NULL;
|
||||
};
|
||||
|
||||
void *run_thread(void *vargs) {
|
||||
write_tile_args *arg = (write_tile_args *) vargs;
|
||||
struct task *task;
|
||||
int *err_or_null = NULL;
|
||||
|
||||
for (task = arg->tasks; task != NULL; task = task->next) {
|
||||
while (true) {
|
||||
bool done = false;
|
||||
|
||||
if (pthread_mutex_lock(&task_lock) != 0) {
|
||||
perror("pthread_mutex_lock");
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
|
||||
struct task *task;
|
||||
if (arg->tasks->size() == 0) {
|
||||
done = true;
|
||||
} else {
|
||||
task = arg->tasks->back();
|
||||
arg->tasks->pop_back();
|
||||
}
|
||||
|
||||
if (pthread_mutex_unlock(&task_lock) != 0) {
|
||||
perror("pthread_mutex_unlock");
|
||||
exit(EXIT_PTHREAD);
|
||||
}
|
||||
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
|
||||
int j = task->fileno;
|
||||
|
||||
if (arg->geomfd[j] < 0) {
|
||||
@@ -2772,7 +2846,6 @@ exit(EXIT_IMPOSSIBLE);
|
||||
dc.begin();
|
||||
}
|
||||
|
||||
arg->wrote_zoom = z;
|
||||
long long len;
|
||||
|
||||
struct zxy parent(z - 1, x / 2, y / 2);
|
||||
@@ -2780,6 +2853,7 @@ exit(EXIT_IMPOSSIBLE);
|
||||
skip_tile(&dc, &geompos, arg->compressed);
|
||||
len = 1;
|
||||
} else {
|
||||
arg->wrote_zoom = z;
|
||||
len = write_tile(&dc, &geompos, arg->global_stringpool, z, x, y, z == arg->maxzoom ? arg->full_detail : arg->low_detail, arg->min_detail, arg->outdb, arg->outdir, arg->buffer, arg->fname, arg->geomfile, arg->geompos, arg->minzoom, arg->maxzoom, arg->todo, arg->along, geompos, arg->gamma, arg->child_shards, arg->pool_off, arg->initial_x, arg->initial_y, arg->running, arg->simplification, arg->layermaps, arg->layer_unmaps, arg->tiling_seg, arg->pass, arg->mingap, arg->minextent, arg->mindrop_sequence, arg->prefilter, arg->postfilter, arg->filter, arg, arg->strategy, arg->compressed, arg->shared_nodes_map, arg->nodepos, *(arg->shared_nodes_bloom), (*arg->unidecode_data), estimated_complexity, arg->skip_children_out);
|
||||
}
|
||||
|
||||
@@ -2873,6 +2947,8 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
||||
std::set<zxy> skip_children;
|
||||
|
||||
int z;
|
||||
int largest_written = -1;
|
||||
|
||||
for (z = iz; z <= maxzoom; z++) {
|
||||
std::atomic<long long> most(0);
|
||||
|
||||
@@ -2939,24 +3015,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
||||
std::vector<task> tasks;
|
||||
tasks.resize(TEMP_FILES);
|
||||
|
||||
struct dispatch {
|
||||
struct task *tasks = NULL;
|
||||
long long todo = 0;
|
||||
struct dispatch *next = NULL;
|
||||
};
|
||||
std::vector<dispatch> dispatches;
|
||||
dispatches.resize(threads);
|
||||
|
||||
dispatch *dispatch_head = &dispatches[0];
|
||||
for (size_t j = 0; j < threads; j++) {
|
||||
dispatches[j].tasks = NULL;
|
||||
dispatches[j].todo = 0;
|
||||
if (j + 1 < threads) {
|
||||
dispatches[j].next = &dispatches[j + 1];
|
||||
} else {
|
||||
dispatches[j].next = NULL;
|
||||
}
|
||||
}
|
||||
std::vector<task *> dispatch;
|
||||
|
||||
for (size_t j = 0; j < TEMP_FILES; j++) {
|
||||
if (geom_size[j] == 0) {
|
||||
@@ -2964,24 +3023,12 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
||||
}
|
||||
|
||||
tasks[j].fileno = j;
|
||||
tasks[j].next = dispatch_head->tasks;
|
||||
dispatch_head->tasks = &tasks[j];
|
||||
dispatch_head->todo += geom_size[j];
|
||||
|
||||
dispatch *here = dispatch_head;
|
||||
dispatch_head = dispatch_head->next;
|
||||
|
||||
dispatch **d;
|
||||
for (d = &dispatch_head; *d != NULL; d = &((*d)->next)) {
|
||||
if (here->todo < (*d)->todo) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
here->next = *d;
|
||||
*d = here;
|
||||
tasks[j].todo = geom_size[j];
|
||||
dispatch.push_back(&tasks[j]);
|
||||
}
|
||||
|
||||
std::sort(dispatch.begin(), dispatch.end());
|
||||
|
||||
int err = INT_MAX;
|
||||
|
||||
double zoom_gamma = gamma;
|
||||
@@ -3001,7 +3048,11 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
||||
atomic_strategy strategy;
|
||||
skip_children_out.clear();
|
||||
|
||||
// must be recreate with each pass, since child threads consume it
|
||||
std::vector<task *> pass_dispatch = dispatch;
|
||||
|
||||
for (size_t thread = 0; thread < threads; thread++) {
|
||||
args[thread].threadno = thread;
|
||||
args[thread].global_stringpool = global_stringpool;
|
||||
args[thread].min_detail = min_detail;
|
||||
args[thread].outdb = outdb; // locked with db_lock
|
||||
@@ -3053,7 +3104,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
||||
args[thread].filter = filter;
|
||||
args[thread].unidecode_data = &unidecode_data;
|
||||
|
||||
args[thread].tasks = dispatches[thread].tasks;
|
||||
args[thread].tasks = &pass_dispatch;
|
||||
args[thread].running = &running;
|
||||
args[thread].pass = pass;
|
||||
args[thread].wrote_zoom = -1;
|
||||
@@ -3117,6 +3168,9 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
||||
if (args[thread].wrote_zoom > z) {
|
||||
z = args[thread].wrote_zoom;
|
||||
}
|
||||
if (args[thread].wrote_zoom > largest_written) {
|
||||
largest_written = args[thread].wrote_zoom;
|
||||
}
|
||||
|
||||
if (args[thread].still_dropping) {
|
||||
extend_zooms = true;
|
||||
@@ -3179,6 +3233,10 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
||||
}
|
||||
}
|
||||
|
||||
if (largest_written >= 0 && maxzoom > largest_written) {
|
||||
maxzoom = largest_written;
|
||||
}
|
||||
|
||||
for (size_t j = 0; j < TEMP_FILES; j++) {
|
||||
// Can be < 0 if there is only one source file, at z0
|
||||
if (geomfd[j] >= 0) {
|
||||
@@ -3202,4 +3260,5 @@ void atomic_strategy::add_from(struct strategy const &src) {
|
||||
coalesced_as_needed += src.coalesced_as_needed;
|
||||
detail_reduced += src.detail_reduced;
|
||||
tiny_polygons += src.tiny_polygons;
|
||||
truncated_zooms += src.truncated_zooms;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ struct atomic_strategy {
|
||||
std::atomic<size_t> coalesced_as_needed;
|
||||
std::atomic<size_t> detail_reduced;
|
||||
std::atomic<size_t> tiny_polygons;
|
||||
std::atomic<size_t> truncated_zooms;
|
||||
|
||||
atomic_strategy()
|
||||
: dropped_by_rate(0),
|
||||
@@ -25,7 +26,8 @@ struct atomic_strategy {
|
||||
dropped_as_needed(0),
|
||||
coalesced_as_needed(0),
|
||||
detail_reduced(0),
|
||||
tiny_polygons(0) {
|
||||
tiny_polygons(0),
|
||||
truncated_zooms(0) {
|
||||
}
|
||||
|
||||
void add_from(struct strategy const &src);
|
||||
@@ -38,6 +40,7 @@ struct strategy {
|
||||
size_t coalesced_as_needed = 0;
|
||||
size_t detail_reduced = 0;
|
||||
size_t tiny_polygons = 0;
|
||||
size_t truncated_zooms = 0;
|
||||
|
||||
size_t tile_size = 0;
|
||||
size_t feature_count = 0;
|
||||
@@ -51,6 +54,7 @@ struct strategy {
|
||||
tile_size = ts;
|
||||
feature_count = fc;
|
||||
tiny_polygons = s.tiny_polygons;
|
||||
truncated_zooms = s.truncated_zooms;
|
||||
}
|
||||
|
||||
strategy() = default;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v2.57.0"
|
||||
#define VERSION "v2.60.0"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user