Compare commits

...
8 Commits
Author SHA1 Message Date
Erica Fischer 02e9e4e952 Only accept longitude corrections that give rings the right winding 2023-12-11 13:38:54 -08:00
Erica Fischer f53d9f77d2 Add more comments 2023-12-11 12:07:42 -08:00
Erica Fischer c719ce2fe5 Merge remote-tracking branch 'origin/main' into polar-buffer 2023-12-11 12:04:51 -08:00
Erica Fischer 15a3e313ff Tolerate polygon rings with insufficiently many points in input (#175)
* Tolerate polygon rings with insufficiently many points in input

* Fix changelog typo
2023-12-11 11:14:26 -08:00
Erica Fischer 80ac56a0b3 Don't use longitude wraparound detection if it makes a contradictory geometry 2023-12-11 11:00:03 -08:00
Erica Fischer d7bdbe363b Reduce maximum memory used for vertex sorting (#170)
* Add logging for out-of-memory debugging

* Use less memory for sub-sorting

* Reduce maximum memory used for vertex sorting
2023-11-30 13:48:50 -08:00
Erica Fischer d359461e61 Reduce tile-join overzooming memory usage (#162)
* 16 bits is enough for tile numbers

* Revert "16 bits is enough for tile numbers"

This reverts commit 71a0c4e1cf.

* Check what child tiles each overzoomed tile will have

and don't queue further overzooming of empty tiles

* Clean up naming; use std::move to avoid copying large arrays
2023-11-08 12:51:28 -08:00
Erica Fischer 2c56187530 Make tile-join distrust source tilesets' metadata maxzoom and minzoom (#161)
* Special-case a longitude wraparound of exactly 360°

* Update version and changelog

* Make tile-join distrust source tilesets' metadata maxzoom and minzoom
2023-11-07 14:41:05 -08:00
30 changed files with 290 additions and 58 deletions
+21
View File
@@ -1,3 +1,24 @@
# 2.39.0
* Don't use longitude wraparound detection if it makes a self-contradictory geometry
# 2.38.0
* Tolerate polygon rings with insuffiently many points in input
# 2.37.1
* Reduce maximum memory used for vertex sorting
# 2.37.0
* Speed up tile-join overzooming and make it use less memory, by not including empty child tiles in the enumeration
# 2.36.0
* Make tile-join distrust the source tilesets' metadata maxzoom and minzoom
* Add a special case in --detect-longitude-wraparound not to wrap around jumps of exactly 360°
# 2.35.0
* Fix a bug in --detect-longitude-wraparound when there are multiple rings
+27 -3
View File
@@ -753,7 +753,8 @@ static std::vector<std::pair<double, double>> clip_poly1(std::vector<std::pair<d
}
std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int ny,
int detail, int buffer, std::set<std::string> const &keep, bool do_compress) {
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles) {
mvt_tile tile;
try {
@@ -767,11 +768,12 @@ std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int
exit(EXIT_PROTOBUF);
}
return overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, do_compress);
return overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, do_compress, next_overzoomed_tiles);
}
std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int ny,
int detail, int buffer, std::set<std::string> const &keep, bool do_compress) {
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles) {
mvt_tile outtile;
for (auto const &layer : tile.layers) {
@@ -890,6 +892,28 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
}
}
if (next_overzoomed_tiles != NULL) {
// will any child tiles have features in them?
// find out recursively from the tile we just made.
//
// (yes, we should keep them instead of remaking them
// later, but that first requires figuring out where to
// keep them.)
if (outtile.layers.size() > 0) {
for (size_t x = 0; x < 2; x++) {
for (size_t y = 0; y < 2; y++) {
std::string child = overzoom(outtile, nz, nx, ny,
nz + 1, nx * 2 + x, ny * 2 + y,
detail, buffer, keep, false, NULL);
if (child.size() > 0) {
next_overzoomed_tiles->emplace_back(nx * 2 + x, ny * 2 + y);
}
}
}
}
}
if (outtile.layers.size() > 0) {
std::string pbf = outtile.encode();
+9 -2
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 enough, avoid a division by zero trying to
// not have any, avoid a division by zero trying to
// calculate the centroid below.
if (j - i < 3) {
if (j - i < 1) {
i = j - 1;
outer = 0;
continue;
@@ -661,6 +661,13 @@ 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
+4 -2
View File
@@ -99,9 +99,11 @@ int pnpoly(const drawvec &vert, size_t start, size_t nvert, long long testx, lon
double distance_from_line(long long point_x, long long point_y, long long segA_x, long long segA_y, long long segB_x, long long segB_y);
std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int ny,
int detail, int buffer, std::set<std::string> const &keep, bool do_compress);
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles);
std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int ny,
int detail, int buffer, std::set<std::string> const &keep, bool do_compress);
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles);
#endif
+2 -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 / 10);
fqsort(vertex_readers, sizeof(vertex), vertexcmp, vertex_out, memsize / 20);
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 / 10);
fqsort(node_readers, sizeof(node), nodecmp, node_out, memsize / 20);
for (size_t i = 0; i < CPUS; i++) {
if (fclose(readers[i].nodefile) != 0) {
+1 -1
View File
@@ -91,7 +91,7 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
std::string out = overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, true);
std::string out = overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, true, NULL);
fwrite(out.c_str(), sizeof(char), out.size(), f);
fclose(f);
+108 -26
View File
@@ -313,38 +313,120 @@ serial_feature deserialize_feature(std::string &geoms, unsigned z, unsigned tx,
return sf;
}
static long long scale_geometry(struct serialization_state *sst, long long *bbox, drawvec &geom) {
long long offset = 0;
long long prev = 0;
bool has_prev = false;
static long long scale_geometry(struct serialization_state *sst, long long *bbox, drawvec &geom, int t) {
double scale = 1.0 / (1 << geometry_scale);
if (additional[A_DETECT_WRAPAROUND]) {
drawvec out;
bool outer = true; // first ring is expected to be outer
for (size_t i = 0; i < geom.size(); i++) {
if (geom[i].op == VT_MOVETO) {
size_t j = 0;
for (j = i + 1; j < geom.size(); j++) {
if (geom[j].op != VT_LINETO) {
break;
}
}
long long prev_x = geom[i].x;
long long offset = 0;
bool balanced = true;
drawvec ring;
bool changed = false;
for (size_t k = i; k < j; k++) {
draw op = geom[k];
op.x += offset;
// jumps at least 180° but not exactly 360°,
// which in some data sets is an intentional
// line across the world
if (op.x - prev_x > (1LL << 31) && op.x - prev_x != (1LL << 32)) {
if (offset < 0) {
// already shifted left, but seems to need another shift left
balanced = false;
break;
}
offset -= 1LL << 32;
op.x -= 1LL << 32;
changed = true;
} else if (prev_x - op.x > (1LL << 31) && prev_x - op.x != (1LL << 32)) {
if (offset > 0) {
// already shifted right, but seems to need another shift right
balanced = false;
break;
}
offset += 1LL << 32;
op.x += 1LL << 32;
changed = true;
}
ring.push_back(op);
prev_x = op.x;
}
if (changed && balanced) {
// If this is a polygon, in which the first and last
// points of each ring are supposed to be identical,
// make sure the antimeridian wraparound detection
// preserves that expectation. If it doesn't, it means
// we have detected something wrongly.
if (geom[j - 1] == geom[i]) {
if (offset != 0) {
// first and last points are supposed to be the same
// but there is an unresolved antimeridian shift
balanced = false;
}
}
if (t == VT_POLYGON) {
// don't accept longitude corrections that would give
// a ring a winding counter to what the geojson structure
// says the winding should be
double area_after = get_area(ring, 0, ring.size());
if ((outer && area_after < 0) ||
(!outer && area_after > 0)) {
// wraparound detection gave a ring a winding different from
// what its position in the GeoJSON structure indicates that
// it should have.
balanced = false;
}
}
}
// If something contradictory happened in longitude
// wraparound detection, restore the original geometry
if (!balanced) {
ring.clear();
for (size_t k = i; k < j; k++) {
ring.push_back(geom[k]);
}
}
for (auto const &g : ring) {
out.push_back(g);
}
i = j - 1;
outer = false;
} else if (geom[i].op == VT_CLOSEPATH) {
out.push_back(geom[i]);
outer = true;
}
}
geom = std::move(out);
}
for (size_t i = 0; i < geom.size(); i++) {
if (geom[i].op == VT_MOVETO || geom[i].op == VT_LINETO) {
long long x = geom[i].x;
long long y = geom[i].y;
if (additional[A_DETECT_WRAPAROUND]) {
if (geom[i].op == VT_LINETO) {
x += offset;
if (has_prev) {
if (x - prev > (1LL << 31)) {
offset -= 1LL << 32;
x -= 1LL << 32;
} else if (prev - x > (1LL << 31)) {
offset += 1LL << 32;
x += 1LL << 32;
}
}
has_prev = true;
prev = x;
} else {
offset = 0;
prev = x;
}
}
if (x < bbox[0]) {
bbox[0] = x;
}
@@ -461,7 +543,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
// try to remind myself that the geometry in this function is in SCALED COORDINATES
drawvec scaled_geometry = sf.geometry;
sf.geometry.clear();
scale_geometry(sst, sf.bbox, scaled_geometry);
scale_geometry(sst, sf.bbox, scaled_geometry, sf.t);
// This has to happen after scaling so that the wraparound detection has happened first.
// Otherwise the inner/outer calculation will be confused by bad geometries.
+5 -1
View File
@@ -4,12 +4,16 @@
#include <vector>
#include <string>
#define MAX_MEMORY (10 * 1024 * 1024)
#define MAX_MEMORY (1024 * 1024 * 1024) // 1 GB
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
@@ -0,0 +1,15 @@
{ "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
@@ -0,0 +1 @@
{ "type": "Feature", "properties": {}, "geometry": { "type": "LineString", "coordinates": [ [ 1, 2 ] ] } }
+1
View File
@@ -0,0 +1 @@
{ "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
@@ -0,0 +1,15 @@
{ "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": [
] }
File diff suppressed because one or more lines are too long
@@ -7,7 +7,7 @@
"generator_options": "./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles '-YALAND10:Land area' '-L{\"file\": \"tests/join-population/tabblock_06001420.json\", \"description\": \"population\"}'; ./tile-join --quiet --force --no-tile-stats -o tests/join-population/joined-no-tile-stats.mbtiles -x GEOID10 -c tests/join-population/population.csv tests/join-population/tabblock_06001420.mbtiles",
"json": "{\"vector_layers\":[{\"id\":\"tabblock_06001420\",\"description\":\"population\",\"minzoom\":3,\"maxzoom\":12,\"fields\":{\"ALAND10\":\"Land area\",\"AWATER10\":\"Number\",\"BLOCKCE10\":\"String\",\"COUNTYFP10\":\"String\",\"FUNCSTAT10\":\"String\",\"INTPTLAT10\":\"String\",\"INTPTLON10\":\"String\",\"MTFCC10\":\"String\",\"NAME10\":\"String\",\"STATEFP10\":\"String\",\"TRACTCE10\":\"String\",\"UACE10\":\"String\",\"UATYP10\":\"String\",\"UR10\":\"String\",\"population\":\"Mixed\"}}]}",
"maxzoom": "12",
"minzoom": "0",
"minzoom": "3",
"name": "tests/join-population/tabblock_06001420.mbtiles",
"strategies": "[{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":258},{\"tiny_polygons\":255},{\"tiny_polygons\":248},{\"tiny_polygons\":151},{\"tiny_polygons\":75},{\"tiny_polygons\":47}]",
"type": "overlay",
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -7,7 +7,7 @@
"generator_options": "./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles '-YALAND10:Land area' '-L{\"file\": \"tests/join-population/tabblock_06001420.json\", \"description\": \"population\"}'; ./tile-join --quiet --force '--tile-stats-sample-values-limit=1' -o tests/join-population/joined-tile-stats-sample-values-limit.mbtiles -x GEOID10 -c tests/join-population/population.csv tests/join-population/tabblock_06001420.mbtiles",
"json": "{\"vector_layers\":[{\"id\":\"tabblock_06001420\",\"description\":\"population\",\"minzoom\":3,\"maxzoom\":12,\"fields\":{\"ALAND10\":\"Land area\",\"AWATER10\":\"Number\",\"BLOCKCE10\":\"String\",\"COUNTYFP10\":\"String\",\"FUNCSTAT10\":\"String\",\"INTPTLAT10\":\"String\",\"INTPTLON10\":\"String\",\"MTFCC10\":\"String\",\"NAME10\":\"String\",\"STATEFP10\":\"String\",\"TRACTCE10\":\"String\",\"UACE10\":\"String\",\"UATYP10\":\"String\",\"UR10\":\"String\",\"population\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"tabblock_06001420\",\"count\":1484,\"geometry\":\"Polygon\",\"attributeCount\":15,\"attributes\":[{\"attribute\":\"ALAND10\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":542505},{\"attribute\":\"AWATER10\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":1632801},{\"attribute\":\"BLOCKCE10\",\"count\":1,\"type\":\"string\",\"values\":[\"1000\"]},{\"attribute\":\"COUNTYFP10\",\"count\":1,\"type\":\"string\",\"values\":[\"001\"]},{\"attribute\":\"FUNCSTAT10\",\"count\":1,\"type\":\"string\",\"values\":[\"S\"]},{\"attribute\":\"INTPTLAT10\",\"count\":1,\"type\":\"string\",\"values\":[\"+37.882724\"]},{\"attribute\":\"INTPTLON10\",\"count\":1,\"type\":\"string\",\"values\":[\"-122.282320\"]},{\"attribute\":\"MTFCC10\",\"count\":1,\"type\":\"string\",\"values\":[\"G5040\"]},{\"attribute\":\"NAME10\",\"count\":1,\"type\":\"string\",\"values\":[\"Block 1000\"]},{\"attribute\":\"STATEFP10\",\"count\":1,\"type\":\"string\",\"values\":[\"06\"]},{\"attribute\":\"TRACTCE10\",\"count\":1,\"type\":\"string\",\"values\":[\"420100\"]},{\"attribute\":\"UACE10\",\"count\":1,\"type\":\"string\",\"values\":[\"78904\"]},{\"attribute\":\"UATYP10\",\"count\":1,\"type\":\"string\",\"values\":[\"U\"]},{\"attribute\":\"UR10\",\"count\":1,\"type\":\"string\",\"values\":[\"R\"]},{\"attribute\":\"population\",\"count\":1,\"type\":\"string\",\"values\":[\"\"]}]}]}}",
"maxzoom": "12",
"minzoom": "0",
"minzoom": "3",
"name": "tests/join-population/tabblock_06001420.mbtiles",
"strategies": "[{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":258},{\"tiny_polygons\":255},{\"tiny_polygons\":248},{\"tiny_polygons\":151},{\"tiny_polygons\":75},{\"tiny_polygons\":47}]",
"type": "overlay",
@@ -7,7 +7,7 @@
"generator_options": "./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles '-YALAND10:Land area' '-L{\"file\": \"tests/join-population/tabblock_06001420.json\", \"description\": \"population\"}'; ./tile-join --quiet --force '--tile-stats-values-limit=1' -o tests/join-population/joined-tile-stats-values-limit.mbtiles -x GEOID10 -c tests/join-population/population.csv tests/join-population/tabblock_06001420.mbtiles",
"json": "{\"vector_layers\":[{\"id\":\"tabblock_06001420\",\"description\":\"population\",\"minzoom\":3,\"maxzoom\":12,\"fields\":{\"ALAND10\":\"Land area\",\"AWATER10\":\"Number\",\"BLOCKCE10\":\"String\",\"COUNTYFP10\":\"String\",\"FUNCSTAT10\":\"String\",\"INTPTLAT10\":\"String\",\"INTPTLON10\":\"String\",\"MTFCC10\":\"String\",\"NAME10\":\"String\",\"STATEFP10\":\"String\",\"TRACTCE10\":\"String\",\"UACE10\":\"String\",\"UATYP10\":\"String\",\"UR10\":\"String\",\"population\":\"Mixed\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"tabblock_06001420\",\"count\":1484,\"geometry\":\"Polygon\",\"attributeCount\":15,\"attributes\":[{\"attribute\":\"ALAND10\",\"count\":257,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":542505}]}]}}",
"maxzoom": "12",
"minzoom": "0",
"minzoom": "3",
"name": "tests/join-population/tabblock_06001420.mbtiles",
"strategies": "[{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":258},{\"tiny_polygons\":255},{\"tiny_polygons\":248},{\"tiny_polygons\":151},{\"tiny_polygons\":75},{\"tiny_polygons\":47}]",
"type": "overlay",
File diff suppressed because one or more lines are too long
@@ -2,13 +2,13 @@
"antimeridian_adjusted_bounds": "237.656250,37.857507,237.744141,37.926868",
"attribution": "macarthur's attribution",
"bounds": "-122.343750,37.695438,-122.104097,37.926868",
"center": "-122.299805,37.892187,12",
"center": "-122.299805,37.892187,11",
"description": "macarthur description",
"format": "pbf",
"generator_options": "./tippecanoe -q -f -Z5 -z10 -o tests/join-population/macarthur.mbtiles -l macarthur tests/join-population/macarthur.json; ./tippecanoe -q -f -d10 -D10 -Z9 -z11 -o tests/join-population/macarthur2.mbtiles -l macarthur tests/join-population/macarthur2.json; ./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles '-YALAND10:Land area' '-L{\"file\": \"tests/join-population/tabblock_06001420.json\", \"description\": \"population\"}'; ./tile-join -q -f -o tests/join-population/merged.mbtiles tests/join-population/tabblock_06001420.mbtiles tests/join-population/macarthur.mbtiles tests/join-population/macarthur2.mbtiles; ./tile-join -q -f -l macarthur -n 'macarthur name' -N 'macarthur description' -A 'macarthur'\"'\"'s attribution' -o tests/join-population/just-macarthur.mbtiles tests/join-population/merged.mbtiles",
"json": "{\"vector_layers\":[{\"id\":\"macarthur\",\"description\":\"\",\"minzoom\":5,\"maxzoom\":11,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"macarthur\",\"count\":171,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":5,\"type\":\"string\",\"values\":[\"Macarthur\",\"Macarthur Blvd\",\"Macarthur Fwy\",\"W Macarthur\",\"W Macarthur Blvd\"]},{\"attribute\":\"LINEARID\",\"count\":42,\"type\":\"string\",\"values\":[\"1102155930810\",\"1102156217102\",\"1102156241736\",\"1102156248968\",\"1102156510290\",\"1102157651658\",\"1102406970092\",\"1102406970093\",\"1102406970094\",\"1102406970095\",\"1102407366406\",\"1102638069562\",\"1102638078801\",\"1102654601627\",\"1102654601663\",\"1102654602215\",\"1102954189105\",\"1102954918511\",\"1103690383700\",\"1103690474249\",\"1103690474250\",\"1103690483026\",\"1103690483032\",\"1103717593123\",\"1104469713187\",\"1104469713198\",\"1104474748623\",\"1104475134288\",\"1104475134436\",\"1104485605278\",\"1104485645649\",\"1104485773833\",\"1104486090991\",\"1104486392881\",\"1105089436004\",\"1105089465114\",\"1105089465116\",\"1105281275434\",\"1105281275687\",\"1105281275688\",\"1105281275689\",\"1105281275692\"]},{\"attribute\":\"MTFCC\",\"count\":2,\"type\":\"string\",\"values\":[\"S1100\",\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]}]}}",
"maxzoom": "12",
"minzoom": "0",
"maxzoom": "11",
"minzoom": "5",
"name": "macarthur name",
"strategies": "[{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":260},{\"tiny_polygons\":258},{\"tiny_polygons\":255},{\"tiny_polygons\":248},{\"tiny_polygons\":151},{\"tiny_polygons\":75},{\"tiny_polygons\":47}]",
"type": "overlay",
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,20 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-179.084872,-42.586987,179.718436,64.188520",
"bounds": "-179.084872,-85.051129,179.718436,64.188520",
"center": "0.000000,0.000000,0",
"description": "tests/wraparound-gap/out/-z0_--detect-longitude-wraparound.json.check.mbtiles",
"format": "pbf",
"generator_options": "./tippecanoe -q -a@ -f -o tests/wraparound-gap/out/-z0_--detect-longitude-wraparound.json.check.mbtiles -z0 --detect-longitude-wraparound tests/wraparound-gap/in.json",
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"felt:color\":\"String\",\"felt:fillOpacity\":\"Number\",\"felt:id\":\"String\",\"felt:locked\":\"Number\",\"felt:ordering\":\"Number\",\"felt:showArea\":\"Number\",\"felt:strokeOpacity\":\"Number\",\"felt:strokeStyle\":\"String\",\"felt:strokeWidth\":\"Number\",\"felt:type\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1,\"geometry\":\"Polygon\",\"attributeCount\":10,\"attributes\":[{\"attribute\":\"felt:color\",\"count\":1,\"type\":\"string\",\"values\":[\"#C93535\"]},{\"attribute\":\"felt:fillOpacity\",\"count\":1,\"type\":\"number\",\"values\":[0.25],\"min\":0.25,\"max\":0.25},{\"attribute\":\"felt:id\",\"count\":1,\"type\":\"string\",\"values\":[\"fdd67048-a864-48d1-9596-fe332d5e2fd8\"]},{\"attribute\":\"felt:locked\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"felt:ordering\",\"count\":1,\"type\":\"number\",\"values\":[1701884658553581],\"min\":1701884658553581,\"max\":1701884658553581},{\"attribute\":\"felt:showArea\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"felt:strokeOpacity\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"felt:strokeStyle\",\"count\":1,\"type\":\"string\",\"values\":[\"solid\"]},{\"attribute\":\"felt:strokeWidth\",\"count\":1,\"type\":\"number\",\"values\":[2],\"min\":2,\"max\":2},{\"attribute\":\"felt:type\",\"count\":1,\"type\":\"string\",\"values\":[\"Polygon\"]}]}]}}",
"maxzoom": "0",
"minzoom": "0",
"name": "tests/wraparound-gap/out/-z0_--detect-longitude-wraparound.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { "felt:color": "#C93535", "felt:fillOpacity": 0.25, "felt:id": "fdd67048-a864-48d1-9596-fe332d5e2fd8", "felt:locked": 0, "felt:ordering": 1701884658553581, "felt:showArea": 0, "felt:strokeOpacity": 1, "felt:strokeStyle": "solid", "felt:strokeWidth": 2, "felt:type": "Polygon" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -68.730469, 64.206377 ], [ -63.281250, 64.052978 ], [ -60.644531, 63.898731 ], [ -55.371094, 63.391522 ], [ -52.910156, 63.074866 ], [ -50.361328, 62.714462 ], [ -45.615234, 61.856149 ], [ -41.220703, 60.802064 ], [ -37.089844, 59.578851 ], [ -35.156250, 58.904646 ], [ -29.707031, 56.704506 ], [ -24.960938, 54.213861 ], [ -19.511719, 50.569283 ], [ -15.996094, 47.576526 ], [ -10.986328, 42.293564 ], [ -8.349609, 38.959409 ], [ -3.164062, 30.600094 ], [ 0.527344, 22.998852 ], [ 3.779297, 16.888660 ], [ 6.679688, 12.125264 ], [ 10.722656, 4.740675 ], [ 16.435547, -6.751896 ], [ 25.048828, -12.382928 ], [ 37.353516, -19.890723 ], [ 44.824219, -23.966176 ], [ 55.019531, -28.921631 ], [ 64.160156, -32.694866 ], [ 70.927734, -35.029996 ], [ 75.146484, -36.315125 ], [ 82.177734, -38.203655 ], [ 89.472656, -39.774769 ], [ 93.955078, -40.580585 ], [ 98.525391, -41.244772 ], [ 103.183594, -41.771312 ], [ 109.511719, -42.293564 ], [ 115.927734, -42.553080 ], [ 122.431641, -42.553080 ], [ 128.935547, -42.293564 ], [ 133.857422, -41.902277 ], [ 137.197266, -41.508577 ], [ 143.789062, -40.044438 ], [ 145.283203, -39.571822 ], [ 151.171875, -37.439974 ], [ 156.796875, -35.101934 ], [ 166.113281, -30.524413 ], [ 173.671875, -26.194877 ], [ 179.736328, -22.350076 ], [ 179.736328, -85.622069 ], [ -179.121094, -85.622069 ], [ -179.121094, -21.534847 ], [ -157.939453, -6.140555 ], [ -143.437500, 13.838080 ], [ -140.712891, 20.632784 ], [ -137.109375, 28.459033 ], [ -133.593750, 34.597042 ], [ -130.429688, 39.368279 ], [ -128.671875, 41.640078 ], [ -123.662109, 47.040182 ], [ -118.916016, 51.013755 ], [ -117.597656, 51.944265 ], [ -113.291016, 54.622978 ], [ -110.039062, 56.316537 ], [ -106.611328, 57.844751 ], [ -102.832031, 59.265881 ], [ -96.591797, 61.100789 ], [ -92.021484, 62.103883 ], [ -87.187500, 62.955223 ], [ -84.638672, 63.273182 ], [ -79.453125, 63.821288 ], [ -76.816406, 63.975961 ], [ -71.367188, 64.168107 ], [ -68.730469, 64.206377 ] ] ], [ [ [ 187.031250, -17.224758 ], [ 187.031250, -85.622069 ], [ 180.878906, -85.622069 ], [ 180.878906, -21.534847 ], [ 187.031250, -17.224758 ] ] ], [ [ [ -180.263672, -22.350076 ], [ -180.263672, -85.622069 ], [ -187.031250, -85.622069 ], [ -187.031250, -26.588527 ], [ -180.263672, -22.350076 ] ] ] ] } }
] }
] }
] }
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+24 -6
View File
@@ -434,7 +434,8 @@ struct tileset_reader {
// for overzooming
int maxzoom_so_far = -1;
std::vector<std::pair<unsigned, unsigned>> tiles_at_maxzoom_so_far;
std::vector<std::pair<unsigned, unsigned>> overzoomed_tiles;
std::vector<std::pair<unsigned, unsigned>> overzoomed_tiles; // tiles at `zoom`
std::vector<std::pair<unsigned, unsigned>> next_overzoomed_tiles; // tiles at `zoom + 1`
bool overzoom_consumed_at_this_zoom = false;
// parent tile cache
@@ -642,12 +643,24 @@ struct tileset_reader {
long long scale = (1LL << zoom) / (1LL << maxzoom_so_far);
for (auto const &xy : tiles_at_maxzoom_so_far) {
for (long long xx = 0; xx < scale; xx++) {
for (long long yy = 0; yy < scale; yy++) {
overzoomed_tiles.push_back(std::pair<unsigned, unsigned>(xy.first * scale + xx, xy.second * scale + yy));
// If this is the first overzoomed level, we don't know yet
// which tiles will be useful, so spell out all 4 child tiles
// from each parent tile.
//
// If it is further overzoomed than that, we have a list of
// which child tiles will have features in them, so use that.
if (zoom == maxzoom_so_far + 1) {
for (auto const &xy : tiles_at_maxzoom_so_far) {
for (long long xx = 0; xx < scale; xx++) {
for (long long yy = 0; yy < scale; yy++) {
overzoomed_tiles.push_back(std::pair<unsigned, unsigned>(xy.first * scale + xx, xy.second * scale + yy));
}
}
}
} else {
overzoomed_tiles = std::move(next_overzoomed_tiles);
next_overzoomed_tiles.clear();
}
std::sort(overzoomed_tiles.begin(), overzoomed_tiles.end(), tilecmp);
@@ -769,7 +782,7 @@ struct tileset_reader {
}
if (source.layers.size() != 0) {
std::string ret = overzoom(source, parent_tile.z, parent_tile.x, parent_tile.y, tile.z, tile.x, tile.y, -1, buffer, std::set<std::string>(), false);
std::string ret = overzoom(source, parent_tile.z, parent_tile.x, parent_tile.y, tile.z, tile.x, tile.y, -1, buffer, std::set<std::string>(), false, &next_overzoomed_tiles);
return ret;
}
@@ -1574,6 +1587,11 @@ int main(int argc, char **argv) {
}
generator_options.append(commandline);
// don't trust the source metadata maxzooms;
// claim the zooms that were actually written
st.maxzoom = INT_MIN;
st.minzoom = INT_MAX;
for (auto &l : layermap) {
if (l.second.minzoom < st.minzoom) {
st.minzoom = l.second.minzoom;
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.35.0"
#define VERSION "v2.39.0"
#endif