mirror of
https://github.com/felt/tippecanoe.git
synced 2026-11-28 11:21:19 +01:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9827fa0c9c | ||
|
|
ef70af09ce | ||
|
|
f3b575ead4 | ||
|
|
f44230f5f5 | ||
|
|
40bb4ff732 | ||
|
|
d891ca7289 | ||
|
|
bc3ef87c3f |
@@ -1,3 +1,27 @@
|
||||
# 2.61.0
|
||||
|
||||
* Fix another bad interaction, this time between dropping-as-needed and --limit-tile-feature-count
|
||||
|
||||
# 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
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
FROM ubuntu:22.04 AS tippecanoe-builder
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install build-essential libsqlite3-dev zlib1g-dev
|
||||
&& apt-get -y install make gcc g++ libsqlite3-dev zlib1g-dev
|
||||
|
||||
COPY . /tmp/tippecanoe-src
|
||||
WORKDIR /tmp/tippecanoe-src
|
||||
@@ -13,7 +13,7 @@ CMD make test
|
||||
# Using multistage build reduces the docker image size by alot by only copying the needed binaries
|
||||
FROM ubuntu:22.04
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install libsqlite3-dev zlib1g-dev \
|
||||
&& apt-get -y install libsqlite3-0 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=tippecanoe-builder /tmp/tippecanoe-src/tippecanoe* /usr/local/bin/
|
||||
COPY --from=tippecanoe-builder /tmp/tippecanoe-src/tile-join /usr/local/bin/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -707,7 +707,7 @@ uses md2man (`gem install md2man`).
|
||||
|
||||
Linux:
|
||||
|
||||
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev
|
||||
sudo apt-get install gcc g++ make libsqlite3-dev zlib1g-dev
|
||||
|
||||
Then build:
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
+4
-4
@@ -76,13 +76,13 @@ drawvec readGeometry(const FlatGeobuf::Geometry *geometry, FlatGeobuf::GeometryT
|
||||
|
||||
if (geometry_type == FlatGeobuf::GeometryType_Point) {
|
||||
return readPoints(geometry);
|
||||
} if (geometry_type == FlatGeobuf::GeometryType_MultiPoint) {
|
||||
} else if (geometry_type == FlatGeobuf::GeometryType_MultiPoint) {
|
||||
return readPoints(geometry);
|
||||
} if (geometry_type == FlatGeobuf::GeometryType_LineString) {
|
||||
} else if (geometry_type == FlatGeobuf::GeometryType_LineString) {
|
||||
return readLinePart(geometry);
|
||||
} else if (h_geometry_type == FlatGeobuf::GeometryType_MultiLineString) {
|
||||
} else if (geometry_type == FlatGeobuf::GeometryType_MultiLineString) {
|
||||
return readLinePart(geometry);
|
||||
} if (geometry_type == FlatGeobuf::GeometryType_Polygon) {
|
||||
} else if (geometry_type == FlatGeobuf::GeometryType_Polygon) {
|
||||
return readLinePart(geometry);
|
||||
} else if (geometry_type == FlatGeobuf::GeometryType_MultiPolygon) {
|
||||
// if it is a GeometryCollection, parse Parts, ignore XY
|
||||
|
||||
+9
-5
@@ -239,7 +239,7 @@ drawvec impose_tile_boundaries(const drawvec &geom, long long extent) {
|
||||
return out;
|
||||
}
|
||||
|
||||
drawvec simplify_lines(drawvec &geom, int z, int tx, int ty, int detail, bool mark_tile_bounds, double simplification, size_t retain, drawvec const &shared_nodes, struct node *shared_nodes_map, size_t nodepos) {
|
||||
drawvec simplify_lines(drawvec &geom, int z, int tx, int ty, int detail, bool mark_tile_bounds, double simplification, size_t retain, drawvec const &shared_nodes, struct node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom) {
|
||||
int res = 1 << (32 - detail - z);
|
||||
long long area = 1LL << (32 - z);
|
||||
|
||||
@@ -276,12 +276,16 @@ drawvec simplify_lines(drawvec &geom, int z, int tx, int ty, int detail, bool ma
|
||||
d.y += ty * (1LL << (32 - z));
|
||||
}
|
||||
|
||||
// to quadkey
|
||||
struct node n;
|
||||
n.index = encode_quadkey((unsigned) d.x, (unsigned) d.y);
|
||||
n.index = encode_vertex((unsigned) d.x, (unsigned) d.y);
|
||||
size_t bloom_ix = n.index % (shared_nodes_bloom.size() * 8);
|
||||
unsigned char bloom_mask = 1 << (bloom_ix & 7);
|
||||
bloom_ix >>= 3;
|
||||
|
||||
if (bsearch(&n, shared_nodes_map, nodepos / sizeof(node), sizeof(node), nodecmp) != NULL) {
|
||||
geom[i].necessary = true;
|
||||
if (shared_nodes_bloom[bloom_ix] & bloom_mask) {
|
||||
if (bsearch(&n, shared_nodes_map, nodepos / sizeof(node), sizeof(node), nodecmp) != NULL) {
|
||||
geom[i].necessary = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ drawvec stairstep(drawvec &geom, int z, int detail);
|
||||
bool point_within_tile(long long x, long long y, int z);
|
||||
int quick_check(const long long *bbox, int z, long long buffer);
|
||||
void douglas_peucker(drawvec &geom, int start, int n, double e, size_t kept, size_t retain, bool prevent_simplify_shared_nodes);
|
||||
drawvec simplify_lines(drawvec &geom, int z, int tx, int ty, int detail, bool mark_tile_bounds, double simplification, size_t retain, drawvec const &shared_nodes, struct node *shared_nodes_map, size_t nodepos);
|
||||
drawvec simplify_lines(drawvec &geom, int z, int tx, int ty, int detail, bool mark_tile_bounds, double simplification, size_t retain, drawvec const &shared_nodes, struct node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom);
|
||||
drawvec reorder_lines(const drawvec &geom);
|
||||
drawvec fix_polygon(const drawvec &geom);
|
||||
std::vector<drawvec> chop_polygon(std::vector<drawvec> &geoms);
|
||||
|
||||
@@ -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"
|
||||
@@ -2070,7 +2069,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
#endif
|
||||
|
||||
struct node n;
|
||||
n.index = encode_quadkey((unsigned) x, (unsigned) y);
|
||||
n.index = encode_vertex((unsigned) x, (unsigned) y);
|
||||
|
||||
fwrite_check((char *) &n, sizeof(struct node), 1, readers[0].nodefile, &readers[0].nodepos, "vertices");
|
||||
}
|
||||
@@ -2084,6 +2083,9 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
fprintf(stderr, "Merging nodes \r");
|
||||
}
|
||||
|
||||
std::string shared_nodes_bloom;
|
||||
shared_nodes_bloom.resize(34567891); // circa 34MB, size nowhere near a power of 2
|
||||
|
||||
// Sort nodes that can't be simplified away; scan the list to remove duplicates
|
||||
|
||||
FILE *shared_nodes;
|
||||
@@ -2149,6 +2151,11 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
fwrite_check((void *) &here, sizeof(here), 1, shared_nodes, &nodepos, "shared nodes");
|
||||
written = here;
|
||||
|
||||
size_t bloom_ix = here.index % (shared_nodes_bloom.size() * 8);
|
||||
unsigned char bloom_mask = 1 << (bloom_ix & 7);
|
||||
bloom_ix >>= 3;
|
||||
shared_nodes_bloom[bloom_ix] |= bloom_mask;
|
||||
|
||||
#if 0
|
||||
unsigned wx, wy;
|
||||
decode_quadkey(here.index, &wx, &wy);
|
||||
@@ -2770,7 +2777,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
std::atomic<unsigned> midx(0);
|
||||
std::atomic<unsigned> midy(0);
|
||||
std::vector<strategy> strategies;
|
||||
int written = traverse_zooms(fd, size, stringpool, &midx, &midy, maxzoom, minzoom, outdb, outdir, buffer, fname, tmpdir, gamma, full_detail, low_detail, min_detail, pool_off, initial_x, initial_y, simplification, maxzoom_simplification, layermaps, prefilter, postfilter, attribute_accum, filter, strategies, iz, shared_nodes_map, nodepos, basezoom, droprate, unidecode_data);
|
||||
int written = traverse_zooms(fd, size, stringpool, &midx, &midy, maxzoom, minzoom, outdb, outdir, buffer, fname, tmpdir, gamma, full_detail, low_detail, min_detail, pool_off, initial_x, initial_y, simplification, maxzoom_simplification, layermaps, prefilter, postfilter, attribute_accum, filter, strategies, iz, shared_nodes_map, nodepos, shared_nodes_bloom, basezoom, droprate, unidecode_data);
|
||||
|
||||
if (maxzoom != written) {
|
||||
if (written > minzoom) {
|
||||
@@ -3059,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},
|
||||
@@ -3600,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')
|
||||
|
||||
@@ -217,3 +217,7 @@ void set_projection_or_exit(const char *optarg) {
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long long encode_vertex(unsigned int wx, unsigned int wy) {
|
||||
return (((unsigned long long) wx) << 32) | wy;
|
||||
}
|
||||
|
||||
@@ -26,4 +26,6 @@ void decode_quadkey(unsigned long long index, unsigned *wx, unsigned *wy);
|
||||
unsigned long long encode_hilbert(unsigned int wx, unsigned int wy);
|
||||
void decode_hilbert(unsigned long long index, unsigned *wx, unsigned *wy);
|
||||
|
||||
unsigned long long encode_vertex(unsigned int wx, unsigned int wy);
|
||||
|
||||
#endif
|
||||
|
||||
+8
-5
@@ -407,7 +407,7 @@ static void add_scaled_node(struct reader *r, serialization_state *sst, draw g)
|
||||
long long y = SHIFT_LEFT(g.y);
|
||||
|
||||
struct node n;
|
||||
n.index = encode_quadkey((unsigned) x, (unsigned) y);
|
||||
n.index = encode_vertex((unsigned) x, (unsigned) y);
|
||||
|
||||
fwrite_check((char *) &n, sizeof(struct node), 1, r->nodefile, &r->nodepos, sst->fname);
|
||||
}
|
||||
@@ -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
@@ -357,7 +357,7 @@ bool find_common_edges(std::vector<serial_feature> &features, int z, int line_de
|
||||
}
|
||||
if (!(prevent[P_SIMPLIFY] || (z == maxzoom && prevent[P_SIMPLIFY_LOW]) || (z < maxzoom && additional[A_GRID_LOW_ZOOMS]))) {
|
||||
// tx and ty are 0 here because we aren't trying to do anything with the shared_nodes_map
|
||||
simplified_arcs[ai->second] = simplify_lines(dv, z, 0, 0, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, 4, drawvec(), NULL, 0);
|
||||
simplified_arcs[ai->second] = simplify_lines(dv, z, 0, 0, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, 4, drawvec(), NULL, 0, "");
|
||||
} else {
|
||||
simplified_arcs[ai->second] = dv;
|
||||
}
|
||||
|
||||
+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
+337
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) {
|
||||
@@ -541,6 +542,7 @@ struct simplification_worker_arg {
|
||||
drawvec *shared_nodes;
|
||||
node *shared_nodes_map;
|
||||
size_t nodepos;
|
||||
std::string const *shared_nodes_bloom;
|
||||
};
|
||||
|
||||
// If a polygon has collapsed away to nothing during polygon cleaning,
|
||||
@@ -590,7 +592,7 @@ static drawvec revive_polygon(drawvec &geom, double area, int z, int detail) {
|
||||
// This simplifies the geometry of one feature. It is generally called from the feature_simplification_worker
|
||||
// but is broken out here so that it can be called from earlier in write_tile if coalesced geometries build up
|
||||
// too much in memory.
|
||||
static double simplify_feature(serial_feature *p, drawvec const &shared_nodes, node *shared_nodes_map, size_t nodepos) {
|
||||
static double simplify_feature(serial_feature *p, drawvec const &shared_nodes, node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom) {
|
||||
drawvec geom = p->geometry;
|
||||
signed char t = p->t;
|
||||
int z = p->z;
|
||||
@@ -637,13 +639,13 @@ static double simplify_feature(serial_feature *p, drawvec const &shared_nodes, n
|
||||
}
|
||||
|
||||
// continues to simplify to line_detail even if we have extra detail
|
||||
drawvec ngeom = simplify_lines(geom, z, p->tx, p->ty, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), p->simplification, t == VT_POLYGON ? 4 : 0, shared_nodes, shared_nodes_map, nodepos);
|
||||
drawvec ngeom = simplify_lines(geom, z, p->tx, p->ty, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), p->simplification, t == VT_POLYGON ? 4 : 0, shared_nodes, shared_nodes_map, nodepos, shared_nodes_bloom);
|
||||
|
||||
if (p->coalesced && prevent[P_SIMPLIFY_SHARED_NODES]) {
|
||||
// do another simplification to eliminate collinearities
|
||||
// that were left behind at the former corners between
|
||||
// coalesced geometries
|
||||
ngeom = simplify_lines(ngeom, z, p->tx, p->ty, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), 0.1, t == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0);
|
||||
ngeom = simplify_lines(ngeom, z, p->tx, p->ty, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), 0.1, t == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0, "");
|
||||
}
|
||||
|
||||
if (t != VT_POLYGON || ngeom.size() >= 3) {
|
||||
@@ -671,7 +673,7 @@ static void *simplification_worker(void *v) {
|
||||
for (size_t i = a->task; i < (*features).size(); i += a->tasks) {
|
||||
double area = 0;
|
||||
if (!a->trying_to_stop_early) {
|
||||
area = simplify_feature(&((*features)[i]), *(a->shared_nodes), a->shared_nodes_map, a->nodepos);
|
||||
area = simplify_feature(&((*features)[i]), *(a->shared_nodes), a->shared_nodes_map, a->nodepos, *(a->shared_nodes_bloom));
|
||||
}
|
||||
|
||||
signed char t = (*features)[i].t;
|
||||
@@ -832,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.
|
||||
@@ -840,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;
|
||||
@@ -896,6 +908,7 @@ struct write_tile_args {
|
||||
bool compressed;
|
||||
node *shared_nodes_map;
|
||||
size_t nodepos;
|
||||
std::string const *shared_nodes_bloom;
|
||||
std::set<zxy> const *skip_children; // what is being skipped at this zoom
|
||||
std::set<zxy> skip_children_out; // what will be skipped in the next zoom
|
||||
};
|
||||
@@ -1512,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
|
||||
@@ -1519,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
|
||||
}
|
||||
@@ -1534,7 +1547,7 @@ void skip_tile(decompressor *geoms, std::atomic<long long> *geompos_in, bool com
|
||||
}
|
||||
}
|
||||
|
||||
long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, char *global_stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, std::atomic<long long> *geompos, int minzoom, int maxzoom, double todo, std::atomic<long long> *along, long long alongminus, double gamma, int child_shards, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic<int> *running, double simplification, std::vector<std::map<std::string, layermap_entry>> *layermaps, std::vector<std::vector<std::string>> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, unsigned long long mindrop_sequence, const char *prefilter, const char *postfilter, json_object *filter, write_tile_args *arg, atomic_strategy *strategy_out, bool compressed_input, node *shared_nodes_map, size_t nodepos, std::vector<std::string> const &unidecode_data, long long estimated_complexity, std::set<zxy> &skip_children_out) {
|
||||
long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, char *global_stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, std::atomic<long long> *geompos, int minzoom, int maxzoom, double todo, std::atomic<long long> *along, long long alongminus, double gamma, int child_shards, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic<int> *running, double simplification, std::vector<std::map<std::string, layermap_entry>> *layermaps, std::vector<std::vector<std::string>> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, unsigned long long mindrop_sequence, const char *prefilter, const char *postfilter, json_object *filter, write_tile_args *arg, atomic_strategy *strategy_out, bool compressed_input, node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom, std::vector<std::string> const &unidecode_data, long long estimated_complexity, std::set<zxy> &skip_children_out) {
|
||||
double merge_fraction = 1;
|
||||
double mingap_fraction = 1;
|
||||
double minextent_fraction = 1;
|
||||
@@ -1569,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;
|
||||
@@ -1627,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++) {
|
||||
@@ -1854,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;
|
||||
}
|
||||
}
|
||||
@@ -1899,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;
|
||||
}
|
||||
}
|
||||
@@ -1918,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;
|
||||
}
|
||||
}
|
||||
@@ -1982,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 && !prevent[P_KILOBYTE_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 || ((adjusted_feature_count > adjusted_max_tile_features) && !prevent[P_FEATURE_LIMIT])) {
|
||||
skipped++;
|
||||
too_many_features = true;
|
||||
} else {
|
||||
kept++;
|
||||
|
||||
@@ -2048,7 +2093,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
// may not be very effective for reducing memory usage.
|
||||
|
||||
for (; simplified_geometry_through < features.size(); simplified_geometry_through++) {
|
||||
simplify_feature(&features[simplified_geometry_through], shared_nodes, shared_nodes_map, nodepos);
|
||||
simplify_feature(&features[simplified_geometry_through], shared_nodes, shared_nodes_map, nodepos, shared_nodes_bloom);
|
||||
|
||||
if (features[simplified_geometry_through].t == VT_POLYGON) {
|
||||
drawvec to_clean = features[simplified_geometry_through].geometry;
|
||||
@@ -2108,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");
|
||||
@@ -2121,9 +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 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;
|
||||
}
|
||||
|
||||
// Operations on the features within each layer:
|
||||
@@ -2243,6 +2292,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
args[i].shared_nodes = &shared_nodes;
|
||||
args[i].shared_nodes_map = shared_nodes_map;
|
||||
args[i].nodepos = nodepos;
|
||||
args[i].shared_nodes_bloom = &shared_nodes_bloom;
|
||||
args[i].trying_to_stop_early = trying_to_stop_early;
|
||||
|
||||
if (tasks > 1) {
|
||||
@@ -2322,7 +2372,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
if (!(prevent[P_SIMPLIFY] || (z == maxzoom && prevent[P_SIMPLIFY_LOW]))) {
|
||||
// XXX revisit: why does this not take zoom into account?
|
||||
layer_features[x].geometry = simplify_lines(layer_features[x].geometry, 32, 0, 0, 0,
|
||||
!(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, layer_features[x].t == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0);
|
||||
!(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, layer_features[x].t == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2357,23 +2407,27 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
|
||||
if (z == maxzoom && limit_tile_feature_count_at_maxzoom != 0) {
|
||||
if (layer_features.size() > limit_tile_feature_count_at_maxzoom) {
|
||||
can_stop_early = false;
|
||||
// this is maxzoom; ok to stop early still because they said to limit abruptly
|
||||
layer_features.resize(limit_tile_feature_count_at_maxzoom);
|
||||
too_many_features = false; // don't try to drop; we have already truncated
|
||||
skipped = 0; // doesn't matter that we skipped features; we have truncated
|
||||
}
|
||||
} else if (limit_tile_feature_count != 0) {
|
||||
if (layer_features.size() > limit_tile_feature_count) {
|
||||
can_stop_early = false;
|
||||
layer_features.resize(limit_tile_feature_count);
|
||||
too_many_features = false; // don't try to drop; we have already truncated
|
||||
skipped = 0; // doesn't matter that we skipped features; we have truncated
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -2464,14 +2518,23 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
continue;
|
||||
}
|
||||
|
||||
if (totalsize > 0 && tile.layers.size() > 0) {
|
||||
if (totalsize > 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, 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) {
|
||||
@@ -2497,7 +2560,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 * 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;
|
||||
@@ -2512,7 +2575,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 * 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;
|
||||
@@ -2526,11 +2589,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 * 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;
|
||||
@@ -2563,31 +2626,30 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
if (trying_to_stop_early && line_detail == first_detail) {
|
||||
// didn't work, try a lower detail
|
||||
detail_reduced++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2608,7 +2670,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;
|
||||
@@ -2623,7 +2685,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;
|
||||
@@ -2637,8 +2699,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;
|
||||
@@ -2663,6 +2725,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) {
|
||||
@@ -2678,6 +2745,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));
|
||||
}
|
||||
|
||||
@@ -2694,17 +2762,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) {
|
||||
@@ -2764,7 +2850,6 @@ exit(EXIT_IMPOSSIBLE);
|
||||
dc.begin();
|
||||
}
|
||||
|
||||
arg->wrote_zoom = z;
|
||||
long long len;
|
||||
|
||||
struct zxy parent(z - 1, x / 2, y / 2);
|
||||
@@ -2772,7 +2857,8 @@ exit(EXIT_IMPOSSIBLE);
|
||||
skip_tile(&dc, &geompos, arg->compressed);
|
||||
len = 1;
|
||||
} else {
|
||||
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->unidecode_data), estimated_complexity, arg->skip_children_out);
|
||||
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);
|
||||
}
|
||||
|
||||
if (pthread_mutex_lock(&var_lock) != 0) {
|
||||
@@ -2838,7 +2924,7 @@ exit(EXIT_IMPOSSIBLE);
|
||||
return err_or_null;
|
||||
}
|
||||
|
||||
int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry>> &layermaps, const char *prefilter, const char *postfilter, std::unordered_map<std::string, attribute_op> const *attribute_accum, json_object *filter, std::vector<strategy> &strategies, int iz, node *shared_nodes_map, size_t nodepos, int basezoom, double droprate, std::vector<std::string> const &unidecode_data) {
|
||||
int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry>> &layermaps, const char *prefilter, const char *postfilter, std::unordered_map<std::string, attribute_op> const *attribute_accum, json_object *filter, std::vector<strategy> &strategies, int iz, node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom, int basezoom, double droprate, std::vector<std::string> const &unidecode_data) {
|
||||
last_progress = 0;
|
||||
|
||||
// The existing layermaps are one table per input thread.
|
||||
@@ -2865,6 +2951,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);
|
||||
|
||||
@@ -2931,24 +3019,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) {
|
||||
@@ -2956,24 +3027,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;
|
||||
@@ -2993,7 +3052,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
|
||||
@@ -3045,7 +3108,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;
|
||||
@@ -3055,6 +3118,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
||||
args[thread].compressed = (z != iz);
|
||||
args[thread].shared_nodes_map = shared_nodes_map;
|
||||
args[thread].nodepos = nodepos;
|
||||
args[thread].shared_nodes_bloom = &shared_nodes_bloom;
|
||||
args[thread].skip_children = &skip_children;
|
||||
args[thread].skip_children_out.clear();
|
||||
|
||||
@@ -3108,6 +3172,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;
|
||||
@@ -3170,6 +3237,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) {
|
||||
@@ -3193,4 +3264,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;
|
||||
@@ -58,7 +62,7 @@ struct strategy {
|
||||
|
||||
// long long write_tile(char **geom, char *stringpool, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int min_detail, int basezoom, sqlite3 *outdb, const char *outdir, double droprate, int buffer, const char *fname, FILE **geomfile, int file_minzoom, int file_maxzoom, double todo, char *geomstart, long long along, double gamma, int nlayers, std::atomic<strategy> *strategy);
|
||||
|
||||
int traverse_zooms(int *geomfd, off_t *geom_size, char *stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry> > &layermap, const char *prefilter, const char *postfilter, std::unordered_map<std::string, attribute_op> const *attribute_accum, struct json_object *filter, std::vector<strategy> &strategies, int iz, struct node *shared_nodes_map, size_t nodepos, int basezoom, double droprate, std::vector<std::string> const &unidecode_data);
|
||||
int traverse_zooms(int *geomfd, off_t *geom_size, char *stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry> > &layermap, const char *prefilter, const char *postfilter, std::unordered_map<std::string, attribute_op> const *attribute_accum, struct json_object *filter, std::vector<strategy> &strategies, int iz, struct node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom, int basezoom, double droprate, std::vector<std::string> const &unidecode_data);
|
||||
|
||||
int manage_gap(unsigned long long index, unsigned long long *previndex, double scale, double gamma, double *gap);
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v2.57.0"
|
||||
#define VERSION "v2.61.0"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user