Compare commits

..
Author SHA1 Message Date
Erica Fischer 96f33d2593 Forgot to take out this printf 2024-08-05 13:38:30 -07:00
Erica Fischer 60ad06a9af Put a bloom filter in front of the binary search for shared nodes 2024-08-05 13:37:40 -07:00
Erica Fischer 53ef0a9984 Better tracking of whether we failed to make a full-detail tile 2024-08-05 11:03:34 -07:00
Erica Fischer a3e4d3cb34 Revert "Fully deprecate -detect-shared-borders into an alias"
This reverts commit 0698aeb766.
2024-08-05 10:56:53 -07:00
Erica Fischer ac117558d8 Revert "Track the distances found in the douglas-peucker recursion"
This reverts commit e5361f8c22.
2024-08-05 10:56:47 -07:00
Erica Fischer a9445d2a69 Revert "Serialize and deserialize the distance with the vertices"
This reverts commit 753f1b7909.
2024-08-05 10:56:36 -07:00
Erica Fischer 753f1b7909 Serialize and deserialize the distance with the vertices 2024-08-02 14:29:39 -07:00
Erica Fischer e5361f8c22 Track the distances found in the douglas-peucker recursion 2024-08-02 14:10:14 -07:00
Erica Fischer 0698aeb766 Fully deprecate -detect-shared-borders into an alias 2024-08-02 13:38:19 -07:00
Erica Fischer 4eb41a1e73 Scale tile feature limit for megatiles in the same way as byte limit 2024-08-01 16:10:14 -07:00
Erica Fischer 893489acb9 Be a little more aggressive in drop-densest determination 2024-08-01 10:40:59 -07:00
Erica Fischer dc3dad2c53 Remove todo about special case below basezoom, which is accounted for 2024-08-01 10:02:08 -07:00
Erica Fischer 2b5e51815d Correct README description 2024-08-01 08:19:40 -07:00
Erica Fischer aec0d2692b Don't double-count feature dropping when the zoom level is retried 2024-07-31 22:29:07 -07:00
Erica Fischer 527a764b35 Now the coalesced tiles in z12 get children in z13 2024-07-31 15:34:14 -07:00
Erica Fischer 040b6388ab Keep a list of parent tiles to skip rather than truncating 2024-07-31 15:26:55 -07:00
Erica Fischer 04d7de757b Current (wrong) behavior when combining coalescing and truncating 2024-07-31 14:37:32 -07:00
Erica Fischer eb723111f9 Cleanup from adding line simplification in overzoom 2024-07-30 15:53:51 -07:00
Erica Fischer 6a6ec0c038 Oops, checking for the wrong expected return value 2024-07-30 15:38:16 -07:00
Erica Fischer 43e5b6147e Fix warnings 2024-07-30 15:38:07 -07:00
Erica Fischer 03ef561050 Fix warning 2024-07-30 15:37:59 -07:00
Erica Fischer 33a46560c5 Don't stop early if we ended up dropping any features.
Rework the can-the-next-zoom-stop-early logic to avoid going
one zoom further than needed.
2024-07-30 15:37:22 -07:00
Erica Fischer 6489aa7f31 Fflush here too before pwriting 2024-07-30 15:36:45 -07:00
Erica Fischer 8f3819dd95 Don't try to stop early in the children if we dropped anything by rate 2024-07-30 15:36:36 -07:00
Erica Fischer d4efb4d728 Add tiny polygon reduction / dust to overzoom 2024-07-30 15:35:22 -07:00
Erica Fischer 830885fea0 If stopping early, don't simplify or clean; leave that to overzoom 2024-07-30 15:27:36 -07:00
Erica Fischer bedfa8af95 Be more conservative, because ever retrying a tile is a big speed hit 2024-07-30 15:27:27 -07:00
Erica Fischer 81436a783d Estimate tile complexity; don't try truncating when unlikely to work 2024-07-30 15:26:09 -07:00
Erica Fischer 049c24c754 Make room for a vertex count in the header of each serialized tile 2024-07-30 15:25:59 -07:00
Erica Fischer cf4f912a10 Forgot to commit the actual code change 2024-07-30 15:25:43 -07:00
Erica Fischer 30a16550f0 Add a test of zoom truncation with limited feature count 2024-07-30 15:25:18 -07:00
Erica Fischer 3c07213317 Stop early if we can make a complete tile 2024-07-30 15:24:40 -07:00
Erica Fischer 7057c2bafe I forgot I already added an option for this 2024-07-30 15:21:31 -07:00
Erica Fischer 744e8b61c9 Changing the detail loop to account for stopping early 2024-07-30 15:21:08 -07:00
Erica Fischer b07509b2f9 Add option and document its intended behavior 2024-07-30 15:19:22 -07:00
Erica Fischer 6e5d714250 Track file position where the child tile data begins 2024-07-30 15:18:57 -07:00
Erica Fischer 22a1e2747f Track output position at the file level instead of within each tile 2024-07-30 15:15:55 -07:00
59 changed files with 236 additions and 240 deletions
-12
View File
@@ -1,15 +1,3 @@
# 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
+2 -3
View File
@@ -1,15 +1,14 @@
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 -DBUILD_INFO=$(BUILD_INFO)
CXXFLAGS := $(CXXFLAGS) -std=c++17 -fPIE -DBUILD_INFO=$(BUILD_INFO)
CFLAGS := $(CFLAGS) -fPIE
CXXFLAGS := $(CXXFLAGS) -std=c++17 -fPIE
LDFLAGS := $(LDFLAGS)
WARNING_FLAGS := -Wall -Wshadow -Wsign-compare -Wextra -Wunreachable-code -Wuninitialized -Wshadow
RELEASE_FLAGS := -O3 -DNDEBUG
+1 -1
View File
@@ -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 `--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.
* `-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.
* `-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.
+3 -2
View File
@@ -49,6 +49,7 @@
#include "tile.hpp"
#include "pool.hpp"
#include "projection.hpp"
#include "version.hpp"
#include "memfile.hpp"
#include "main.hpp"
#include "geojson.hpp"
@@ -3066,7 +3067,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, '~'},
{"generate-variable-depth-tile-pyramid", no_argument, &additional[A_VARIABLE_DEPTH_PYRAMID], 1},
{"truncate-zooms", no_argument, &additional[A_TRUNCATE_ZOOMS], 1},
{"one-tile", required_argument, 0, 'R'},
{"Tile resolution", 0, 0, 0},
@@ -3607,7 +3608,7 @@ int main(int argc, char **argv) {
}
case 'v':
fprintf(stderr, "tippecanoe %s\n", version_str().c_str());
fprintf(stderr, "tippecanoe %s\n", VERSION);
exit(EXIT_SUCCESS);
case 'P':
+1 -1
View File
@@ -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\-\-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.
\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.
.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.
+1 -20
View File
@@ -444,14 +444,6 @@ 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();
}
@@ -654,17 +646,6 @@ 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;
@@ -695,7 +676,7 @@ metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minla
m.attribution = attribution;
}
m.generator = program + " " + version_str();
m.generator = program + " " + VERSION;
m.generator_options = commandline;
m.strategies_json = stringify_strategies(strategies);
-1
View File
@@ -77,6 +77,5 @@ 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
View File
@@ -26,7 +26,7 @@
#define A_HILBERT ((int) 'h')
#define A_VISVALINGAM ((int) 'v')
#define A_GENERATE_POLYGON_LABEL_POINTS ((int) 'P')
#define A_VARIABLE_DEPTH_PYRAMID ((int) 't')
#define A_TRUNCATE_ZOOMS ((int) 't')
#define P_SIMPLIFY ((int) 's')
#define P_SIMPLIFY_LOW ((int) 'S')
+4 -7
View File
@@ -423,15 +423,12 @@ 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) {
// standard -180 to 180 world plane
//
// mask X, since it wraps around
// pin Y, since it doesn't
if (sf.geometry[i].y > 0 && sf.geometry[i].y < 0xFFFFFFFF) {
// standard -180 to 180 world plane
long long x = sf.geometry[i].x & 0xFFFFFFFF;
long long y = std::max(std::min(sf.geometry[i].y, 0xFFFFFFFFLL), 0LL);
long long x = sf.geometry[i].x & 0xFFFFFFFF;
long long y = sf.geometry[i].y & 0xFFFFFFFF;
{
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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
"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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
"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,-85.051129,359.744029,85.051129",
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
"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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
"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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
"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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "3.757458,-85.051129,359.744029,85.051129",
"antimeridian_adjusted_bounds": "3.757458,-84.969764,359.744029,85.007238",
"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.051129,359.950215,83.645130",
"antimeridian_adjusted_bounds": "0.023803,-85.040752,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 -1
View File
@@ -1,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-175.220564,-41.299988,179.216647,85.051129",
"antimeridian_adjusted_bounds": "-175.220564,-41.299988,179.216647,64.150024",
"bounds": "-180.000000,-41.299988,180.000000,85.051129",
"center": "0.000000,0.000000,0",
"description": "tests/csv/out-null.mbtiles",
+1 -1
View File
@@ -1,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-175.220564,-41.299988,179.216647,85.051129",
"antimeridian_adjusted_bounds": "-175.220564,-41.299988,179.216647,64.150024",
"bounds": "-180.000000,-41.299988,180.000000,85.051129",
"center": "0.000000,0.000000,0",
"description": "tests/csv/out.mbtiles",
+1 -1
View File
@@ -1,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-135.232962,-85.051129,-135.232962,-85.051129",
"antimeridian_adjusted_bounds": "180.000000,85.051129,-180.000000,-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 -1
View File
@@ -1,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.000000,-85.051129,0.000000,-85.051129",
"antimeridian_adjusted_bounds": "180.000000,85.051129,-180.000000,-85.051129",
"bounds": "-180.000000,-85.051129,180.000000,-85.051129",
"center": "0.000000,-85.051129,0",
"format": "pbf",
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.023802,-85.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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.051129,359.950216,83.645130",
"antimeridian_adjusted_bounds": "0.023802,-85.040752,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",
+1 -1
View File
@@ -1,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "0.000000,85.051129,0.000000,85.051129",
"antimeridian_adjusted_bounds": "180.000000,85.051129,-180.000000,-85.051129",
"bounds": "-180.000000,85.051129,180.000000,85.051129",
"center": "-179.989014,85.051129,14",
"description": "tests/raw-tiles/nothing",
@@ -1,5 +1,5 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-180.000000,12.583700,179.688000,85.051129",
"antimeridian_adjusted_bounds": "-180.000000,12.583700,179.688000,85.027900",
"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",
-2
View File
@@ -877,8 +877,6 @@ 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) {
+68 -98
View File
@@ -66,7 +66,6 @@ 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) {
@@ -834,15 +833,6 @@ 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.
@@ -851,8 +841,7 @@ struct task {
// by the caller to determine whether the zoom level needs to be done over with
// new thresholds.
struct write_tile_args {
int threadno;
std::vector<task *> *tasks;
struct task *tasks = NULL;
char *global_stringpool = NULL;
int min_detail = 0;
sqlite3 *outdb = NULL;
@@ -1521,7 +1510,7 @@ struct layer_features {
size_t multiplier_cluster_size = 0; // The feature count of the current multiplier cluster
};
bool drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer_features &layer, serial_feature &sf, std::vector<std::vector<std::string>> *layer_unmaps, size_t &multiplier_seq, strategy &strategy, bool &drop_rest_of_cluster, std::unordered_map<std::string, attribute_op> const *attribute_accum) {
bool drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer_features &layer, serial_feature &sf, std::vector<std::vector<std::string>> *layer_unmaps, size_t &multiplier_seq, strategy &strategy, bool &drop_rest, std::unordered_map<std::string, attribute_op> const *attribute_accum) {
ssize_t which_serial_feature;
if (find_feature_to_accumulate_onto(layer.features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
@@ -1533,7 +1522,7 @@ bool drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer_features
} else {
preserve_attributes(attribute_accum, sf, layer.features[which_serial_feature]);
strategy.dropped_as_needed++;
drop_rest_of_cluster = true;
drop_rest = true;
return true; // dropped
}
}
@@ -1582,7 +1571,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_TRUNCATE_ZOOMS]) {
// 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.
@@ -1640,9 +1629,6 @@ 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++) {
@@ -1744,8 +1730,8 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
struct multiplier_state multiplier_state;
size_t multiplier_seq = retain_points_multiplier - 1;
bool drop_rest_of_cluster = false; // are we dropping the remainder of a multiplier cluster whose first point was dropped?
bool dropping_by_rate = false; // are we dropping anything by rate in this tile, or keeping it only as part of a multiplier?
bool drop_rest = false; // are we dropping the remainder of a multiplier cluster whose first point was dropped?
bool dropping_by_rate = false; // are we dropping anything by rate in this tile, or keeping it only as part of a multiplier?
unsigned long long next_feature_previndex = 0;
strategy strategy;
@@ -1800,7 +1786,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
if (sf.dropped == FEATURE_KEPT) {
// this is a new multiplier cluster, so stop dropping features
// that were dropped because the previous lead feature was dropped
drop_rest_of_cluster = false;
drop_rest = false;
} else {
can_stop_early = false;
@@ -1814,7 +1800,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
}
}
if (sf.dropped == FEATURE_DROPPED || drop_rest_of_cluster) {
if (sf.dropped == FEATURE_DROPPED || drop_rest) {
multiplier_seq = (multiplier_seq + 1) % retain_points_multiplier;
if (find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
@@ -1829,13 +1815,13 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
// only the first point of a multiplier cluster can be dropped
// by any of these mechanisms. (but if one is, it drags the whole
// cluster down with it by setting drop_rest_of_cluster).
// cluster down with it by setting drop_rest).
if (sf.dropped == FEATURE_KEPT) {
if (gamma > 0) {
if (manage_gap(sf.index, &previndex, scale, gamma, &gap) && find_feature_to_accumulate_onto(features, sf, which_serial_feature, layer_unmaps, LLONG_MAX, multiplier_seq)) {
preserve_attributes(arg->attribute_accum, sf, features[which_serial_feature]);
strategy.dropped_by_gamma++;
drop_rest_of_cluster = true;
drop_rest = true;
can_stop_early = false;
continue;
}
@@ -1863,14 +1849,14 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
preserve_attributes(arg->attribute_accum, sf, features[which_serial_feature]);
strategy.coalesced_as_needed++;
drop_rest_of_cluster = true;
drop_rest = true;
can_stop_early = false;
continue;
}
} else if (additional[A_DROP_DENSEST_AS_NEEDED]) {
add_sample_to(gaps, sf.gap, gaps_increment, seq);
if (sf.gap < mingap) {
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, multiplier_seq, strategy, drop_rest_of_cluster, arg->attribute_accum)) {
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;
}
@@ -1895,7 +1881,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
preserve_attributes(arg->attribute_accum, sf, features[which_serial_feature]);
strategy.coalesced_as_needed++;
drop_rest_of_cluster = true;
drop_rest = true;
continue;
}
} else if (additional[A_COALESCE_DENSEST_AS_NEEDED]) {
@@ -1906,7 +1892,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
coalesced_area += sf.extent;
preserve_attributes(arg->attribute_accum, sf, features[which_serial_feature]);
strategy.coalesced_as_needed++;
drop_rest_of_cluster = true;
drop_rest = true;
can_stop_early = false;
continue;
}
@@ -1915,7 +1901,7 @@ 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) {
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, multiplier_seq, strategy, drop_rest_of_cluster, arg->attribute_accum)) {
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;
}
@@ -1928,7 +1914,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
coalesced_area += sf.extent;
preserve_attributes(arg->attribute_accum, sf, features[which_serial_feature]);
strategy.coalesced_as_needed++;
drop_rest_of_cluster = true;
drop_rest = true;
can_stop_early = false;
continue;
}
@@ -1937,7 +1923,7 @@ 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 (mindrop_sequence != 0 && drop_sequence <= mindrop_sequence) {
if (drop_feature_unless_it_can_be_added_to_a_multiplier_cluster(layer, sf, layer_unmaps, multiplier_seq, strategy, drop_rest_of_cluster, arg->attribute_accum)) {
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;
}
@@ -1949,7 +1935,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
features[which_serial_feature].coalesced = true;
preserve_attributes(arg->attribute_accum, sf, features[which_serial_feature]);
strategy.coalesced_as_needed++;
drop_rest_of_cluster = true;
drop_rest = true;
can_stop_early = false;
continue;
}
@@ -1998,24 +1984,10 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
unsigned long long sfindex = sf.index;
if (sf.geometry.size() > 0) {
// Adjust tile size limit based on the ratio of multiplier cluster features to lead features
size_t scaled_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;
}
size_t scaled_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;
}
if (too_many_bytes || lead_features_count > scaled_max_tile_size) {
if (lead_features_count > max_tile_size || (lead_features_count + other_multiplier_cluster_features_count > max_tile_features && !prevent[P_FEATURE_LIMIT])) {
// 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 || (lead_features_count + other_multiplier_cluster_features_count > scaled_max_tile_features && !prevent[P_FEATURE_LIMIT])) {
skipped++;
too_many_features = true;
} else {
kept++;
@@ -2138,7 +2110,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_VARIABLE_DEPTH_PYRAMID]) {
if (additional[A_TRUNCATE_ZOOMS]) {
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");
@@ -2500,15 +2472,13 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
}
if (totalsize > 0 && tile.layers.size() > 0) {
if (too_many_features || (totalsize > scaled_max_tile_features && !prevent[P_FEATURE_LIMIT])) {
if (totalsize > scaled_max_tile_features && !prevent[P_FEATURE_LIMIT]) {
if (totalsize > arg->feature_count_out) {
arg->feature_count_out = totalsize;
}
size_t estimated = totalsize * (skipped + kept) / kept;
if (!quiet) {
fprintf(stderr, "tile %d/%u/%u has %zu (estimated %zu) features, >%zu \n", z, tx, ty, totalsize, estimated, scaled_max_tile_features);
fprintf(stderr, "tile %d/%u/%u has %zu features, >%zu \n", z, tx, ty, totalsize, scaled_max_tile_features);
}
if (trying_to_stop_early && line_detail == first_detail) {
@@ -2534,7 +2504,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 / estimated * 0.80;
mingap_fraction = mingap_fraction * scaled_max_tile_features / totalsize * 0.80;
unsigned long long m = choose_mingap(gaps, mingap_fraction, mingap);
if (m != mingap) {
mingap = m;
@@ -2549,7 +2519,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 / estimated * 0.75;
minextent_fraction = minextent_fraction * scaled_max_tile_features / totalsize * 0.75;
long long m = choose_minextent(extents, minextent_fraction, minextent);
if (m != minextent) {
minextent = m;
@@ -2567,7 +2537,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
// 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 / estimated * 0.95;
mindrop_sequence_fraction = mindrop_sequence_fraction * scaled_max_tile_features / totalsize * 0.95;
unsigned long long m = choose_mindrop_sequence(drop_sequences, mindrop_sequence_fraction, mindrop_sequence);
if (m != mindrop_sequence) {
mindrop_sequence = m;
@@ -2604,7 +2574,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
// printf("%lld %zu\n", estimated_complexity, compressed.size());
}
if (too_many_bytes || (compressed.size() > scaled_max_tile_size && !prevent[P_KILOBYTE_LIMIT])) {
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
@@ -2701,11 +2671,6 @@ 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) {
@@ -2721,7 +2686,6 @@ 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));
}
@@ -2738,35 +2702,17 @@ 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;
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;
}
for (task = arg->tasks; task != NULL; task = task->next) {
int j = task->fileno;
if (arg->geomfd[j] < 0) {
@@ -2993,7 +2939,24 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
std::vector<task> tasks;
tasks.resize(TEMP_FILES);
std::vector<task *> dispatch;
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;
}
}
for (size_t j = 0; j < TEMP_FILES; j++) {
if (geom_size[j] == 0) {
@@ -3001,11 +2964,23 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
}
tasks[j].fileno = j;
tasks[j].todo = geom_size[j];
dispatch.push_back(&tasks[j]);
}
tasks[j].next = dispatch_head->tasks;
dispatch_head->tasks = &tasks[j];
dispatch_head->todo += geom_size[j];
std::sort(dispatch.begin(), dispatch.end());
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;
}
int err = INT_MAX;
@@ -3026,11 +3001,7 @@ 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
@@ -3082,7 +3053,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 = &pass_dispatch;
args[thread].tasks = dispatches[thread].tasks;
args[thread].running = &running;
args[thread].pass = pass;
args[thread].wrote_zoom = -1;
@@ -3231,5 +3202,4 @@ 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;
}
+1 -5
View File
@@ -18,7 +18,6 @@ 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),
@@ -26,8 +25,7 @@ struct atomic_strategy {
dropped_as_needed(0),
coalesced_as_needed(0),
detail_reduced(0),
tiny_polygons(0),
truncated_zooms(0) {
tiny_polygons(0) {
}
void add_from(struct strategy const &src);
@@ -40,7 +38,6 @@ 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;
@@ -54,7 +51,6 @@ struct strategy {
tile_size = ts;
feature_count = fc;
tiny_polygons = s.tiny_polygons;
truncated_zooms = s.truncated_zooms;
}
strategy() = default;
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.59.0"
#define VERSION "v2.57.0"
#endif