Compare commits

..
16 changed files with 121 additions and 143 deletions
+1 -9
View File
@@ -1,14 +1,6 @@
# 2.39.0
* Reduce memory usage during tiling
# 2.38.0
* Tolerate polygon rings with insuffiently many points in input
# 2.37.1
* Reduce maximum memory used for vertex sorting
* Add --reject-null-geometry and more checking of GeoJSON polygon and linestring validity
# 2.37.0
+1
View File
@@ -533,6 +533,7 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
* `-pW` or `--reverse-source-polygon-winding`: Instead of respecting GeoJSON polygon ring order, use the opposite of the original polygon winding in the source data to distinguish inner (counterclockwise) and outer (clockwise) polygon rings.
* `--clip-bounding-box=`*minlon*`,`*minlat*`,`*maxlon*`,`*maxlat*: Clip all features to the specified bounding box.
* `-aP` or `--convert-polygons-to-label-points`: Replace polygon geometries with a label point or points for the polygon in each tile it intersects.
* `--reject-null-geometry`: Exit with an error when a feature has a `null` geometry instead of just giving a warning.
### Setting or disabling tile size limits
+1
View File
@@ -19,5 +19,6 @@
#define EXIT_UNLINK 118
#define EXIT_UTF8 119
#define EXIT_WRITE 120
#define EXIT_INCORRECT_GEOMETRY 121
// avoid 124, 125, 126, 127, 137, which are used by GNU timeout
+4
View File
@@ -49,6 +49,10 @@ int serialize_geojson_feature(struct serialization_state *sst, json_object *geom
fprintf(stderr, "%s:%d: null geometry (additional not reported): ", sst->fname, sst->line);
json_context(feature);
warned = 1;
if (additional[A_REJECT_NULL_GEOMETRY]) {
exit(EXIT_INCORRECT_GEOMETRY);
}
}
return 0;
+2 -9
View File
@@ -642,9 +642,9 @@ drawvec fix_polygon(drawvec &geom) {
// A polygon ring must contain at least three points
// (and really should contain four). If this one does
// not have any, avoid a division by zero trying to
// not have enough, avoid a division by zero trying to
// calculate the centroid below.
if (j - i < 1) {
if (j - i < 3) {
i = j - 1;
outer = 0;
continue;
@@ -661,13 +661,6 @@ drawvec fix_polygon(drawvec &geom) {
ring.push_back(ring[0]);
}
// A polygon ring at this point should contain at least four points.
// Flesh it out with some vertex copies if it doesn't.
while (ring.size() < 4) {
ring.push_back(ring[0]);
}
// Reverse ring if winding order doesn't match
// inner/outer expectation
+3 -2
View File
@@ -2041,7 +2041,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
vertex_readers.push_back(readers[i].vertexfile);
rewind(readers[i].vertexfile);
}
fqsort(vertex_readers, sizeof(vertex), vertexcmp, vertex_out, memsize / 20);
fqsort(vertex_readers, sizeof(vertex), vertexcmp, vertex_out, memsize / 10);
for (size_t i = 0; i < CPUS; i++) {
if (fclose(readers[i].vertexfile) != 0) {
@@ -2107,7 +2107,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
rewind(readers[i].nodefile);
}
fqsort(node_readers, sizeof(node), nodecmp, node_out, memsize / 20);
fqsort(node_readers, sizeof(node), nodecmp, node_out, memsize / 10);
for (size_t i = 0; i < CPUS; i++) {
if (fclose(readers[i].nodefile) != 0) {
@@ -3214,6 +3214,7 @@ int main(int argc, char **argv) {
{"reverse-source-polygon-winding", no_argument, &prevent[P_REVERSE_SOURCE_POLYGON_WINDING], 1},
{"clip-bounding-box", required_argument, 0, '~'},
{"convert-polygons-to-label-points", no_argument, &additional[A_GENERATE_POLYGON_LABEL_POINTS], 1},
{"reject-null-geometry", no_argument, &additional[A_REJECT_NULL_GEOMETRY], 1},
{"Filtering tile contents", 0, 0, 0},
{"prefilter", required_argument, 0, 'C'},
+2
View File
@@ -695,6 +695,8 @@ the line or polygon within one tile unit of its proper location. You can probabl
\fB\fC\-\-clip\-bounding\-box=\fR\fIminlon\fP\fB\fC,\fR\fIminlat\fP\fB\fC,\fR\fImaxlon\fP\fB\fC,\fR\fImaxlat\fP: Clip all features to the specified bounding box.
.IP \(bu 2
\fB\fC\-aP\fR or \fB\fC\-\-convert\-polygons\-to\-label\-points\fR: Replace polygon geometries with a label point or points for the polygon in each tile it intersects.
.IP \(bu 2
\fB\fC\-\-reject\-null\-geometry\fR: Exit with an error when a feature has a \fB\fCnull\fR geometry instead of just giving a warning.
.RE
.SS Setting or disabling tile size limits
.RS
+1
View File
@@ -26,6 +26,7 @@
#define A_HILBERT ((int) 'h')
#define A_VISVALINGAM ((int) 'v')
#define A_GENERATE_POLYGON_LABEL_POINTS ((int) 'P')
#define A_REJECT_NULL_GEOMETRY ((int) '0')
#define P_SIMPLIFY ((int) 's')
#define P_SIMPLIFY_LOW ((int) 'S')
+18
View File
@@ -103,6 +103,14 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
}
if (t == GEOM_POLYGON) {
if (out.size() < 3) {
fprintf(stderr, "%s:%d: polygon must contain at least three points: ", fname, line);
json_context(j);
fprintf(stderr, "%s:%d: polygon must contain at least three points: ", fname, line);
json_context(feature);
exit(EXIT_INCORRECT_GEOMETRY);
}
// Note that this is not using the correct meaning of closepath.
//
// We are using it here to close an entire Polygon, to distinguish
@@ -114,6 +122,16 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
out.push_back(draw(VT_CLOSEPATH, 0, 0));
}
if (t == GEOM_LINESTRING) {
if (out.size() < 2) {
fprintf(stderr, "%s:%d: linestring must contain at least two points: ", fname, line);
json_context(j);
fprintf(stderr, "%s:%d: linestring must contain at least two points: ", fname, line);
json_context(feature);
exit(EXIT_INCORRECT_GEOMETRY);
}
}
}
void stringify_value(json_object *value, int &type, std::string &stringified, const char *reading, int line, json_object *feature) {
+1 -5
View File
@@ -4,16 +4,12 @@
#include <vector>
#include <string>
#define MAX_MEMORY (1024 * 1024 * 1024) // 1 GB
#define MAX_MEMORY (10 * 1024 * 1024)
void fqsort(std::vector<FILE *> &inputs, size_t width, int (*cmp)(const void *, const void *), FILE *out, size_t mem) {
std::string pivot;
FILE *fp1, *fp2;
if (mem > MAX_MEMORY) {
mem = MAX_MEMORY;
}
{
// read some elements into memory to choose a pivot from
//
-15
View File
@@ -1,15 +0,0 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "1.000000,2.000000,1.000000,2.000000",
"bounds": "1.000000,2.000000,1.000000,2.000000",
"center": "1.000000,2.000000,0",
"description": "tests/invalid-linestring/out/-z0.json.check.mbtiles",
"format": "pbf",
"generator_options": "./tippecanoe -q -a@ -f -o tests/invalid-linestring/out/-z0.json.check.mbtiles -z0 tests/invalid-linestring/too-few.json",
"json": "{\"vector_layers\":[{\"id\":\"toofew\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"toofew\",\"count\":1,\"geometry\":\"LineString\",\"attributeCount\":0,\"attributes\":[]}]}}",
"maxzoom": "0",
"minzoom": "0",
"name": "tests/invalid-linestring/out/-z0.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
] }
-1
View File
@@ -1 +0,0 @@
{ "type": "Feature", "properties": {}, "geometry": { "type": "LineString", "coordinates": [ [ 1, 2 ] ] } }
-1
View File
@@ -1 +0,0 @@
{ "type": "Feature", "properties": { "handle": 717, "block": -1, "etype": 13, "space": 0, "layer": "0", "olinetype": "BYLAYER", "linetype": "", "color": "0,0,0,255", "ocolor": 7, "color24": -1, "transparency": 0, "lweight": -1, "linewidth": 0.0, "ltscale": 1.0, "visible": 1, "thickness": 0.0, "ext": null, "name": "SOLID", "solid": 1, "associative": 0, "hstyle": 1, "hpattern": 1, "doubleflag": 0, "angle": 0.0, "scale": 0.0, "deflines": 0 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -135.2329619, -85.526118 ], [ -135.2329619, -85.526118 ] ] ] ] } }
-15
View File
@@ -1,15 +0,0 @@
{ "type": "FeatureCollection", "properties": {
"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",
"format": "pbf",
"generator_options": "./tippecanoe -q -a@ -f -o tests/invalid-polygon/out/-z0.json.check.mbtiles -z0 tests/invalid-polygon/in.json",
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"angle\":\"Number\",\"associative\":\"Number\",\"block\":\"Number\",\"color\":\"String\",\"color24\":\"Number\",\"deflines\":\"Number\",\"doubleflag\":\"Number\",\"etype\":\"Number\",\"handle\":\"Number\",\"hpattern\":\"Number\",\"hstyle\":\"Number\",\"layer\":\"String\",\"linetype\":\"String\",\"linewidth\":\"Number\",\"ltscale\":\"Number\",\"lweight\":\"Number\",\"name\":\"String\",\"ocolor\":\"Number\",\"olinetype\":\"String\",\"scale\":\"Number\",\"solid\":\"Number\",\"space\":\"Number\",\"thickness\":\"Number\",\"transparency\":\"Number\",\"visible\":\"Number\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1,\"geometry\":\"Polygon\",\"attributeCount\":25,\"attributes\":[{\"attribute\":\"angle\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"associative\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"block\",\"count\":1,\"type\":\"number\",\"values\":[-1],\"min\":-1,\"max\":-1},{\"attribute\":\"color\",\"count\":1,\"type\":\"string\",\"values\":[\"0,0,0,255\"]},{\"attribute\":\"color24\",\"count\":1,\"type\":\"number\",\"values\":[-1],\"min\":-1,\"max\":-1},{\"attribute\":\"deflines\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"doubleflag\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"etype\",\"count\":1,\"type\":\"number\",\"values\":[13],\"min\":13,\"max\":13},{\"attribute\":\"handle\",\"count\":1,\"type\":\"number\",\"values\":[717],\"min\":717,\"max\":717},{\"attribute\":\"hpattern\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"hstyle\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"layer\",\"count\":1,\"type\":\"string\",\"values\":[\"0\"]},{\"attribute\":\"linetype\",\"count\":1,\"type\":\"string\",\"values\":[\"\"]},{\"attribute\":\"linewidth\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"ltscale\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"lweight\",\"count\":1,\"type\":\"number\",\"values\":[-1],\"min\":-1,\"max\":-1},{\"attribute\":\"name\",\"count\":1,\"type\":\"string\",\"values\":[\"SOLID\"]},{\"attribute\":\"ocolor\",\"count\":1,\"type\":\"number\",\"values\":[7],\"min\":7,\"max\":7},{\"attribute\":\"olinetype\",\"count\":1,\"type\":\"string\",\"values\":[\"BYLAYER\"]},{\"attribute\":\"scale\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"solid\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"space\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"thickness\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"transparency\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"visible\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1}]}]}}",
"maxzoom": "0",
"minzoom": "0",
"name": "tests/invalid-polygon/out/-z0.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
] }
+86 -85
View File
@@ -1609,6 +1609,34 @@ serial_feature next_feature(decompressor *geoms, std::atomic<long long> *geompos
}
}
bool legit_geometry(int t, const drawvec &g) {
bool legit = false;
for (size_t i = 0; i < g.size(); i++) {
if (g[i].op == VT_MOVETO) {
size_t j;
for (j = i + 1; j < g.size(); j++) {
if (g[j].op != VT_LINETO) {
break;
}
}
if (t == VT_LINE && j < i + 2) {
return false;
}
if (t == VT_POLYGON && j < i + 3) {
return false;
}
legit = true; // must contain at least one ring
i = j - 1;
}
}
return legit;
}
struct run_prefilter_args {
decompressor *geoms = NULL;
std::atomic<long long> *geompos_in = NULL;
@@ -1657,6 +1685,11 @@ void *run_prefilter(void *v) {
tmp_layer.extent = 1LL << 32;
tmp_layer.name = (*(rpa->layer_unmaps))[sf.segment][sf.layer];
// make sure the geometry is actually legal geojson
if (!legit_geometry(sf.t, sf.geometry)) {
continue;
}
if (sf.t == VT_POLYGON) {
sf.geometry = close_poly(sf.geometry);
}
@@ -1898,19 +1931,6 @@ void add_sample_to(std::vector<T> &vals, T val, size_t &increment, size_t seq) {
}
}
void coalesce_geometry(partial &p, serial_feature &sf) {
// if the geometry being coalesced on is an exact duplicate
// of an existing geometry, just drop it
for (size_t i = 0; i < p.geoms.size(); i++) {
if (p.geoms[i] == sf.geometry) {
return;
}
}
p.geoms.push_back(sf.geometry);
}
long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, char *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, 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, double fraction, const char *prefilter, const char *postfilter, struct json_object *filter, write_tile_args *arg, atomic_strategy *strategy, bool compressed_input, struct node *shared_nodes_map, size_t nodepos) {
double merge_fraction = 1;
double mingap_fraction = 1;
@@ -2158,7 +2178,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
indices.push_back(sf.index);
}
if (sf.index - merge_previndex < mingap && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
coalesce_geometry(partials[which_partial], sf);
partials[which_partial].geoms.push_back(sf.geometry);
partials[which_partial].coalesced = true;
coalesced_area += sf.extent;
preserve_attributes(arg->attribute_accum, sf, stringpool, pool_off, partials[which_partial]);
@@ -2177,7 +2197,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
} else if (additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
add_sample_to(extents, sf.extent, extents_increment, seq);
if (minextent != 0 && sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, minextent)) {
coalesce_geometry(partials[which_partial], sf);
partials[which_partial].geoms.push_back(sf.geometry);
partials[which_partial].coalesced = true;
coalesced_area += sf.extent;
preserve_attributes(arg->attribute_accum, sf, stringpool, pool_off, partials[which_partial]);
@@ -2201,7 +2221,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
fraction_accum += fraction;
if (fraction_accum < 1 && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
if (additional[A_COALESCE_FRACTION_AS_NEEDED]) {
coalesce_geometry(partials[which_partial], sf);
partials[which_partial].geoms.push_back(sf.geometry);
partials[which_partial].coalesced = true;
coalesced_area += sf.extent;
strategy->coalesced_as_needed++;
@@ -2303,19 +2323,11 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
for (; simplified_geometry_through < partials.size(); simplified_geometry_through++) {
simplify_partial(&partials[simplified_geometry_through], dv, shared_nodes_map, nodepos);
if (partials[simplified_geometry_through].t == VT_POLYGON) {
drawvec to_clean;
for (auto &g : partials[simplified_geometry_through].geoms) {
for (auto &d : g) {
to_clean.push_back(d);
}
for (auto &g : partials[simplified_geometry_through].geoms) {
if (partials[simplified_geometry_through].t == VT_POLYGON) {
// don't scale up because this is still world coordinates
g = clean_or_clip_poly(g, 0, 0, false, false);
}
// don't scale up because this is still world coordinates
to_clean = clean_or_clip_poly(to_clean, 0, 0, false, false);
partials[simplified_geometry_through].geoms.clear();
partials[simplified_geometry_through].geoms.push_back(to_clean);
}
}
@@ -2451,8 +2463,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
}
}
std::reverse(partials.begin(), partials.end());
for (ssize_t i = partials.size() - 1; i >= 0; i--) {
for (size_t i = 0; i < partials.size(); i++) {
std::vector<drawvec> &pgeoms = partials[i].geoms;
signed char t = partials[i].t;
long long original_seq = partials[i].original_seq;
@@ -2496,8 +2507,6 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
l->second.push_back(c);
}
}
partials.erase(partials.begin() + i);
}
partials.clear();
@@ -2518,64 +2527,56 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
std::sort(layer_features.begin(), layer_features.end());
}
if (additional[A_COALESCE]) {
// coalesce adjacent identical features if requested
std::vector<coalesce> out;
if (layer_features.size() > 0) {
out.push_back(layer_features[0]);
}
for (size_t x = 1; x < layer_features.size(); x++) {
size_t y = out.size() - 1;
size_t out = 0;
if (layer_features.size() > 0) {
out++;
#if 0
if (out.size() > 0 && coalcmp(&layer_features[x], &out[y]) < 0) {
fprintf(stderr, "\nfeature out of order\n");
}
#endif
for (size_t x = 1; x < layer_features.size(); x++) {
size_t y = out - 1;
if (out > 0 && coalcmp(&layer_features[x], &layer_features[y]) == 0) {
for (size_t g = 0; g < layer_features[x].geom.size(); g++) {
layer_features[y].geom.push_back(layer_features[x].geom[g]);
}
layer_features[y].coalesced = true;
} else {
layer_features[out++] = layer_features[x];
if (additional[A_COALESCE] && out.size() > 0 && coalcmp(&layer_features[x], &out[y]) == 0) {
for (size_t g = 0; g < layer_features[x].geom.size(); g++) {
out[y].geom.push_back(layer_features[x].geom[g]);
}
out[y].coalesced = true;
} else {
out.push_back(layer_features[x]);
}
layer_features.resize(out);
}
{
// clean up coalesced linestrings by simplification
// and coalesced polygons by cleaning
//
// then close polygons
layer_features = out;
size_t out = 0;
for (size_t x = 0; x < layer_features.size(); x++) {
if (layer_features[x].coalesced && layer_features[x].type == VT_LINE) {
layer_features[x].geom = remove_noop(layer_features[x].geom, layer_features[x].type, 0);
if (!(prevent[P_SIMPLIFY] || (z == maxzoom && prevent[P_SIMPLIFY_LOW]))) {
// XXX revisit: why does this not take zoom into account?
layer_features[x].geom = simplify_lines(layer_features[x].geom, 32, 0, 0, 0,
!(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, layer_features[x].type == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0);
}
}
if (layer_features[x].type == VT_POLYGON) {
if (layer_features[x].coalesced) {
// we can try scaling up because this is tile coordinates
layer_features[x].geom = clean_or_clip_poly(layer_features[x].geom, 0, 0, false, true);
}
layer_features[x].geom = close_poly(layer_features[x].geom);
}
if (layer_features[x].geom.size() > 0) {
layer_features[out++] = layer_features[x];
out.clear();
for (size_t x = 0; x < layer_features.size(); x++) {
if (layer_features[x].coalesced && layer_features[x].type == VT_LINE) {
layer_features[x].geom = remove_noop(layer_features[x].geom, layer_features[x].type, 0);
if (!(prevent[P_SIMPLIFY] || (z == maxzoom && prevent[P_SIMPLIFY_LOW]))) {
// XXX revisit: why does this not take zoom into account?
layer_features[x].geom = simplify_lines(layer_features[x].geom, 32, 0, 0, 0,
!(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, layer_features[x].type == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0);
}
}
layer_features.resize(out);
if (layer_features[x].type == VT_POLYGON) {
if (layer_features[x].coalesced) {
// we can try scaling up because this is tile coordinates
layer_features[x].geom = clean_or_clip_poly(layer_features[x].geom, 0, 0, false, true);
}
layer_features[x].geom = close_poly(layer_features[x].geom);
}
if (layer_features[x].geom.size() > 0) {
out.push_back(layer_features[x]);
}
}
layer_features = out;
if (prevent[P_INPUT_ORDER]) {
std::sort(layer_features.begin(), layer_features.end(), preservecmp);
@@ -2597,19 +2598,16 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
}
mvt_tile tile;
size_t totalsize = 0;
for (auto layer_iterator = layers.begin(); layer_iterator != layers.end(); ++layer_iterator) {
std::vector<coalesce> &layer_features = layer_iterator->second;
totalsize += layer_features.size();
mvt_layer layer;
layer.name = layer_iterator->first;
layer.version = 2;
layer.extent = 1 << tile_detail;
std::reverse(layer_features.begin(), layer_features.end());
for (ssize_t x = layer_features.size() - 1; x >= 0; x--) {
for (size_t x = 0; x < layer_features.size(); x++) {
mvt_feature feature;
if (layer_features[x].type == VT_LINE || layer_features[x].type == VT_POLYGON) {
@@ -2657,7 +2655,6 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
}
layer.features.push_back(feature);
layer_features.erase(layer_features.begin() + x);
}
if (layer.features.size() > 0) {
@@ -2674,6 +2671,12 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
fprintf(stderr, "Is your data in the wrong projection? It should be in WGS84/EPSG:4326.\n");
}
size_t totalsize = 0;
for (auto layer_iterator = layers.begin(); layer_iterator != layers.end(); ++layer_iterator) {
std::vector<coalesce> &layer_features = layer_iterator->second;
totalsize += layer_features.size();
}
size_t passes = pass + 1;
double progress = floor(((((*geompos_in + *along - alongminus) / (double) todo) + pass) / passes + z) / (maxzoom + 1) * 1000) / 10;
if (progress >= oprogress + 0.1) {
@@ -2774,8 +2777,6 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
std::string compressed;
std::string pbf = tile.encode();
tile.layers.clear();
if (!prevent[P_TILE_COMPRESSION]) {
compress(pbf, compressed, true);
} else {
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.39.0"
#define VERSION "v2.38.0"
#endif