mirror of
https://github.com/felt/tippecanoe.git
synced 2026-11-23 08:51:18 +01:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ce9f686a1 | ||
|
|
cdfda19777 | ||
|
|
1e2813ed65 | ||
|
|
d7bdbe363b | ||
|
|
d359461e61 | ||
|
|
2c56187530 |
@@ -1,3 +1,21 @@
|
||||
# 2.38.0
|
||||
|
||||
* `tippecanoe-overzoom` can now merge multiple tiles when overzooming them
|
||||
* Add `--stop-after` option to `tile-join` to limit the total number of tiles copied
|
||||
|
||||
# 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
|
||||
|
||||
@@ -278,6 +278,16 @@ overzoom-test: tippecanoe-overzoom
|
||||
./tippecanoe-decode tests/pbf/13-1310-3166.pbf 13 1310 3166 > tests/pbf/13-1310-3166.pbf.json.check
|
||||
cmp tests/pbf/13-1310-3166.pbf.json.check tests/pbf/13-1310-3166.pbf.json
|
||||
rm tests/pbf/13-1310-3166.pbf tests/pbf/13-1310-3166.pbf.json.check
|
||||
# Basic operation, multiple input form
|
||||
./tippecanoe-overzoom -o tests/pbf/13-1310-3166.pbf -t 13/1310/3166 tests/pbf/11-327-791.pbf 11/327/791
|
||||
./tippecanoe-decode tests/pbf/13-1310-3166.pbf 13 1310 3166 > tests/pbf/13-1310-3166.pbf.json.check
|
||||
cmp tests/pbf/13-1310-3166.pbf.json.check tests/pbf/13-1310-3166.pbf.json
|
||||
rm tests/pbf/13-1310-3166.pbf tests/pbf/13-1310-3166.pbf.json.check
|
||||
# Multiple inputs
|
||||
./tippecanoe-overzoom -o tests/pbf/13-1310-3166-ne.pbf -t 13/1310/3166 tests/pbf/11-327-791.pbf 11/327/791 tests/pbf/0-0-0.pbf 0/0/0
|
||||
./tippecanoe-decode tests/pbf/13-1310-3166-ne.pbf 13 1310 3166 > tests/pbf/13-1310-3166-ne.pbf.json.check
|
||||
cmp tests/pbf/13-1310-3166-ne.pbf.json.check tests/pbf/13-1310-3166-ne.pbf.json
|
||||
rm tests/pbf/13-1310-3166-ne.pbf tests/pbf/13-1310-3166-ne.pbf.json.check
|
||||
# Different detail and buffer, and attribute stripping
|
||||
./tippecanoe-overzoom -d8 -b30 -y NAME -y name -y scalerank -o tests/pbf/13-1310-3166-8-30.pbf tests/pbf/11-327-791.pbf 11/327/791 13/1310/3166
|
||||
./tippecanoe-decode tests/pbf/13-1310-3166-8-30.pbf 13 1310 3166 > tests/pbf/13-1310-3166-8-30.pbf.json.check
|
||||
@@ -421,7 +431,13 @@ join-test: tippecanoe tippecanoe-decode tile-join
|
||||
./tile-join --overzoom -f -o tests/ne_110m_ocean/join/joined.mbtiles tests/ne_110m_ocean/join/ocean.mbtiles tests/ne_110m_ocean/join/countries.mbtiles
|
||||
./tippecanoe-decode -x generator tests/ne_110m_ocean/join/joined.mbtiles > tests/ne_110m_ocean/join/joined.mbtiles.json.check
|
||||
cmp tests/ne_110m_ocean/join/joined.mbtiles.json.check tests/ne_110m_ocean/join/joined.mbtiles.json
|
||||
rm -f tests/ne_110m_ocean/join/ocean.mbtiles tests/ne_110m_ocean/join/countries.mbtiles tests/ne_110m_ocean/join/joined.mbtiles tests/ne_110m_ocean/join/joined.mbtiles.json.check
|
||||
#
|
||||
# Test overzooming with tile count limit
|
||||
#
|
||||
./tile-join --overzoom -f -o tests/ne_110m_ocean/join/joined.mbtiles --stop-after 50 tests/ne_110m_ocean/join/ocean.mbtiles tests/ne_110m_ocean/join/countries.mbtiles
|
||||
./tippecanoe-decode -x generator tests/ne_110m_ocean/join/joined.mbtiles > tests/ne_110m_ocean/join/joined.mbtiles-50.json.check
|
||||
cmp tests/ne_110m_ocean/join/joined.mbtiles-50.json.check tests/ne_110m_ocean/join/joined.mbtiles-50.json
|
||||
rm -f tests/ne_110m_ocean/join/ocean.mbtiles tests/ne_110m_ocean/join/countries.mbtiles tests/ne_110m_ocean/join/joined.mbtiles tests/ne_110m_ocean/join/joined.mbtiles.json.check tests/ne_110m_ocean/join/joined.mbtiles-50.json.check
|
||||
|
||||
join-filter-test: tippecanoe tippecanoe-decode tile-join
|
||||
# Comes out different from the direct tippecanoe run because null attributes are lost
|
||||
|
||||
@@ -793,6 +793,7 @@ The options are:
|
||||
|
||||
* `-z` _zoom_ or `--maximum-zoom=`_zoom_: Don't copy tiles from higher zoom levels than the specified zoom
|
||||
* `-Z` _zoom_ or `--minimum-zoom=`_zoom_: Don't copy tiles from lower zoom levels than the specified zoom
|
||||
* `-a` _count_ or `--stop-after=`_count_: Stop copying tile from additional zoom levels after the specified _count_ of tiles has been written to the output.
|
||||
|
||||
### Merging attributes from a CSV file
|
||||
|
||||
@@ -984,10 +985,15 @@ to turn those into moderate detail tiles at high zoom levels, for the benefit of
|
||||
renderers that cannot internally overzoom high-resolution tiles without losing
|
||||
some of the precision. Running:
|
||||
|
||||
tippecanoe-overzoom -o out.mvt.gz inz/inx/iny outz/outx/outy in.mvt.gz
|
||||
tippecanoe-overzoom -o out.mvt.gz in.mvt.gz inz/inx/iny outz/outx/outy
|
||||
|
||||
reads tile `inz/inx/iny` of `in.mvt.gz` and produces tile `outz/outx/outy` of `out.mvt.gz`.
|
||||
|
||||
tippecanoe-overzoom -o out.mvt.gz -t outz/outx/outy in.mvt.gz inz/inx/iny in2.mvt.gz in2z/in2x/in2y in3.mvt.gz in3z/in3x/in3y
|
||||
|
||||
reads tile `inz/inx/iny` of `in.mvt.gz`, tile `in2z/in2x/in2y` of `in2.mvt.gz`, and tile `in3z/in3x/in3y` of `in3.mvt.gz`,
|
||||
and produces tile `outz/outx/outy` of `out.mvt.gz` from them.
|
||||
|
||||
### Options
|
||||
|
||||
* `-b` *buffer*: Set the tile buffer in the output tile (default 5)
|
||||
|
||||
@@ -752,141 +752,203 @@ static std::vector<std::pair<double, double>> clip_poly1(std::vector<std::pair<d
|
||||
return out;
|
||||
}
|
||||
|
||||
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) {
|
||||
mvt_tile tile;
|
||||
std::string overzoom(std::vector<input_tile> tiles, int nz, int nx, int ny,
|
||||
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles) {
|
||||
std::vector<source_tile> decoded;
|
||||
|
||||
try {
|
||||
bool was_compressed;
|
||||
if (!tile.decode(s, was_compressed)) {
|
||||
fprintf(stderr, "Couldn't parse tile %d/%u/%u\n", oz, ox, oy);
|
||||
exit(EXIT_MVT);
|
||||
for (auto const &t : tiles) {
|
||||
mvt_tile tile;
|
||||
|
||||
try {
|
||||
bool was_compressed;
|
||||
if (!tile.decode(t.tile, was_compressed)) {
|
||||
fprintf(stderr, "Couldn't parse tile %d/%u/%u\n", t.z, t.x, t.y);
|
||||
exit(EXIT_MVT);
|
||||
}
|
||||
} catch (std::exception const &e) {
|
||||
fprintf(stderr, "PBF decoding error in tile %d/%u/%u\n", t.z, t.x, t.y);
|
||||
exit(EXIT_PROTOBUF);
|
||||
}
|
||||
} catch (std::exception const &e) {
|
||||
fprintf(stderr, "PBF decoding error in tile %d/%u/%u\n", oz, ox, oy);
|
||||
exit(EXIT_PROTOBUF);
|
||||
|
||||
source_tile out;
|
||||
out.tile = tile;
|
||||
out.z = t.z;
|
||||
out.x = t.x;
|
||||
out.y = t.y;
|
||||
|
||||
decoded.push_back(out);
|
||||
}
|
||||
|
||||
return overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, do_compress);
|
||||
return overzoom(decoded, 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) {
|
||||
std::string overzoom(std::vector<source_tile> tiles, int nz, int nx, int ny,
|
||||
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) {
|
||||
mvt_layer outlayer = mvt_layer();
|
||||
for (auto const &tile : tiles) {
|
||||
for (auto const &layer : tile.tile.layers) {
|
||||
mvt_layer *outlayer = NULL;
|
||||
|
||||
int det = detail;
|
||||
if (det <= 0) {
|
||||
det = std::round(log(layer.extent) / log(2));
|
||||
}
|
||||
int det = detail;
|
||||
if (det <= 0) {
|
||||
det = std::round(log(layer.extent) / log(2));
|
||||
}
|
||||
|
||||
outlayer.name = layer.name;
|
||||
outlayer.version = layer.version;
|
||||
outlayer.extent = 1LL << det;
|
||||
|
||||
for (auto const &feature : layer.features) {
|
||||
mvt_feature outfeature;
|
||||
drawvec geom;
|
||||
int t = feature.type;
|
||||
|
||||
// Convert feature geometry to world coordinates
|
||||
|
||||
long long tilesize = 1LL << (32 - oz); // source tile size in world coordinates
|
||||
draw ring_closure(0, 0, 0);
|
||||
|
||||
for (auto const &g : feature.geometry) {
|
||||
if (g.op == mvt_closepath) {
|
||||
geom.push_back(ring_closure);
|
||||
} else {
|
||||
geom.emplace_back(g.op,
|
||||
g.x * tilesize / layer.extent + ox * tilesize,
|
||||
g.y * tilesize / layer.extent + oy * tilesize);
|
||||
|
||||
if (g.op == mvt_moveto) {
|
||||
ring_closure = geom.back();
|
||||
ring_closure.op = mvt_lineto;
|
||||
}
|
||||
for (size_t i = 0; i < outtile.layers.size(); i++) {
|
||||
if (outtile.layers[i].name == layer.name) {
|
||||
outlayer = &outtile.layers[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Now offset from world coordinates to output tile coordinates,
|
||||
// but retain world scale, because that is what tippecanoe clipping expects
|
||||
if (outlayer == NULL) {
|
||||
mvt_layer newlayer = mvt_layer();
|
||||
|
||||
long long outtilesize = 1LL << (32 - nz); // destination tile size in world coordinates
|
||||
for (auto &g : geom) {
|
||||
g.x -= nx * outtilesize;
|
||||
g.y -= ny * outtilesize;
|
||||
newlayer.name = layer.name;
|
||||
newlayer.version = layer.version;
|
||||
newlayer.extent = 1LL << det;
|
||||
|
||||
outtile.layers.push_back(newlayer);
|
||||
outlayer = &outtile.layers.back();
|
||||
}
|
||||
|
||||
// Clip to output tile
|
||||
for (auto const &feature : layer.features) {
|
||||
mvt_feature outfeature;
|
||||
drawvec geom;
|
||||
int t = feature.type;
|
||||
|
||||
long long xmin = LLONG_MAX;
|
||||
long long ymin = LLONG_MAX;
|
||||
long long xmax = LLONG_MIN;
|
||||
long long ymax = LLONG_MIN;
|
||||
// Convert feature geometry to world coordinates
|
||||
|
||||
for (auto const &g : geom) {
|
||||
xmin = std::min(xmin, g.x);
|
||||
ymin = std::min(ymin, g.y);
|
||||
xmax = std::max(xmax, g.x);
|
||||
ymax = std::max(ymax, g.y);
|
||||
}
|
||||
long long tilesize = 1LL << (32 - tile.z); // source tile size in world coordinates
|
||||
draw ring_closure(0, 0, 0);
|
||||
|
||||
long long b = outtilesize * buffer / 256;
|
||||
if (xmax < -b || ymax < -b || xmin > outtilesize + b || ymin > outtilesize + b) {
|
||||
continue;
|
||||
}
|
||||
for (auto const &g : feature.geometry) {
|
||||
if (g.op == mvt_closepath) {
|
||||
geom.push_back(ring_closure);
|
||||
} else {
|
||||
geom.emplace_back(g.op,
|
||||
g.x * tilesize / layer.extent + tile.x * tilesize,
|
||||
g.y * tilesize / layer.extent + tile.y * tilesize);
|
||||
|
||||
if (t == VT_LINE) {
|
||||
geom = clip_lines(geom, nz, buffer);
|
||||
} else if (t == VT_POLYGON) {
|
||||
drawvec dv;
|
||||
geom = simple_clip_poly(geom, nz, buffer, dv, false);
|
||||
} else if (t == VT_POINT) {
|
||||
geom = clip_point(geom, nz, buffer);
|
||||
}
|
||||
|
||||
// Scale to output tile extent
|
||||
|
||||
to_tile_scale(geom, nz, det);
|
||||
|
||||
// Clean geometries
|
||||
|
||||
geom = remove_noop(geom, t, 0);
|
||||
if (t == VT_POLYGON) {
|
||||
geom = clean_or_clip_poly(geom, 0, 0, false, false);
|
||||
geom = close_poly(geom);
|
||||
}
|
||||
|
||||
// Add geometry to output feature
|
||||
|
||||
outfeature.type = t;
|
||||
for (auto const &g : geom) {
|
||||
outfeature.geometry.emplace_back(g.op, g.x, g.y);
|
||||
}
|
||||
|
||||
// ID and attributes, if it didn't get clipped away
|
||||
|
||||
if (outfeature.geometry.size() > 0) {
|
||||
if (feature.has_id) {
|
||||
outfeature.has_id = true;
|
||||
outfeature.id = feature.id;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i + 1 < feature.tags.size(); i += 2) {
|
||||
if (keep.size() == 0 || keep.find(layer.keys[feature.tags[i]]) != keep.end()) {
|
||||
outlayer.tag(outfeature, layer.keys[feature.tags[i]], layer.values[feature.tags[i + 1]]);
|
||||
if (g.op == mvt_moveto) {
|
||||
ring_closure = geom.back();
|
||||
ring_closure.op = mvt_lineto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outlayer.features.push_back(outfeature);
|
||||
// Now offset from world coordinates to output tile coordinates,
|
||||
// but retain world scale, because that is what tippecanoe clipping expects
|
||||
|
||||
long long outtilesize = 1LL << (32 - nz); // destination tile size in world coordinates
|
||||
for (auto &g : geom) {
|
||||
g.x -= nx * outtilesize;
|
||||
g.y -= ny * outtilesize;
|
||||
}
|
||||
|
||||
// Clip to output tile
|
||||
|
||||
long long xmin = LLONG_MAX;
|
||||
long long ymin = LLONG_MAX;
|
||||
long long xmax = LLONG_MIN;
|
||||
long long ymax = LLONG_MIN;
|
||||
|
||||
for (auto const &g : geom) {
|
||||
xmin = std::min(xmin, g.x);
|
||||
ymin = std::min(ymin, g.y);
|
||||
xmax = std::max(xmax, g.x);
|
||||
ymax = std::max(ymax, g.y);
|
||||
}
|
||||
|
||||
long long b = outtilesize * buffer / 256;
|
||||
if (xmax < -b || ymax < -b || xmin > outtilesize + b || ymin > outtilesize + b) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (t == VT_LINE) {
|
||||
geom = clip_lines(geom, nz, buffer);
|
||||
} else if (t == VT_POLYGON) {
|
||||
drawvec dv;
|
||||
geom = simple_clip_poly(geom, nz, buffer, dv, false);
|
||||
} else if (t == VT_POINT) {
|
||||
geom = clip_point(geom, nz, buffer);
|
||||
}
|
||||
|
||||
// Scale to output tile extent
|
||||
|
||||
to_tile_scale(geom, nz, det);
|
||||
|
||||
// Clean geometries
|
||||
|
||||
geom = remove_noop(geom, t, 0);
|
||||
if (t == VT_POLYGON) {
|
||||
geom = clean_or_clip_poly(geom, 0, 0, false, false);
|
||||
geom = close_poly(geom);
|
||||
}
|
||||
|
||||
// Add geometry to output feature
|
||||
|
||||
outfeature.type = t;
|
||||
for (auto const &g : geom) {
|
||||
outfeature.geometry.emplace_back(g.op, g.x, g.y);
|
||||
}
|
||||
|
||||
// ID and attributes, if it didn't get clipped away
|
||||
|
||||
if (outfeature.geometry.size() > 0) {
|
||||
if (feature.has_id) {
|
||||
outfeature.has_id = true;
|
||||
outfeature.id = feature.id;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i + 1 < feature.tags.size(); i += 2) {
|
||||
if (keep.size() == 0 || keep.find(layer.keys[feature.tags[i]]) != keep.end()) {
|
||||
outlayer->tag(outfeature, layer.keys[feature.tags[i]], layer.values[feature.tags[i + 1]]);
|
||||
}
|
||||
}
|
||||
|
||||
outlayer->features.push_back(outfeature);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (outlayer.features.size() > 0) {
|
||||
outtile.layers.push_back(outlayer);
|
||||
for (ssize_t i = outtile.layers.size() - 1; i >= 0; i--) {
|
||||
if (outtile.layers[i].features.size() == 0) {
|
||||
outtile.layers.erase(outtile.layers.begin() + i);
|
||||
}
|
||||
}
|
||||
|
||||
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++) {
|
||||
source_tile st;
|
||||
st.tile = outtile;
|
||||
st.z = nz;
|
||||
st.x = nx;
|
||||
st.y = ny;
|
||||
|
||||
std::vector<source_tile> sts;
|
||||
sts.push_back(st);
|
||||
|
||||
std::string child = overzoom(sts,
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-4
@@ -98,10 +98,26 @@ void visvalingam(drawvec &ls, size_t start, size_t end, double threshold, size_t
|
||||
int pnpoly(const drawvec &vert, size_t start, size_t nvert, long long testx, long long testy);
|
||||
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);
|
||||
struct input_tile {
|
||||
std::string tile;
|
||||
int z;
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
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);
|
||||
struct source_tile {
|
||||
mvt_tile tile;
|
||||
int z;
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
std::string overzoom(std::vector<source_tile> tiles, int nz, int nx, int ny,
|
||||
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::vector<input_tile> tiles, int nz, int nx, int ny,
|
||||
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+12
-1
@@ -1005,6 +1005,8 @@ The options are:
|
||||
\fB\fC\-z\fR \fIzoom\fP or \fB\fC\-\-maximum\-zoom=\fR\fIzoom\fP: Don't copy tiles from higher zoom levels than the specified zoom
|
||||
.IP \(bu 2
|
||||
\fB\fC\-Z\fR \fIzoom\fP or \fB\fC\-\-minimum\-zoom=\fR\fIzoom\fP: Don't copy tiles from lower zoom levels than the specified zoom
|
||||
.IP \(bu 2
|
||||
\fB\fC\-a\fR \fIcount\fP or \fB\fC\-\-stop\-after=\fR\fIcount\fP: Stop copying tile from additional zoom levels after the specified \fIcount\fP of tiles has been written to the output.
|
||||
.RE
|
||||
.SS Merging attributes from a CSV file
|
||||
.RS
|
||||
@@ -1247,11 +1249,20 @@ some of the precision. Running:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
tippecanoe\-overzoom \-o out.mvt.gz inz/inx/iny outz/outx/outy in.mvt.gz
|
||||
tippecanoe\-overzoom \-o out.mvt.gz in.mvt.gz inz/inx/iny outz/outx/outy
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
reads tile \fB\fCinz/inx/iny\fR of \fB\fCin.mvt.gz\fR and produces tile \fB\fCoutz/outx/outy\fR of \fB\fCout.mvt.gz\fR\&.
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
tippecanoe\-overzoom \-o out.mvt.gz \-t outz/outx/outy in.mvt.gz inz/inx/iny in2.mvt.gz in2z/in2x/in2y in3.mvt.gz in3z/in3x/in3y
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
reads tile \fB\fCinz/inx/iny\fR of \fB\fCin.mvt.gz\fR, tile \fB\fCin2z/in2x/in2y\fR of \fB\fCin2.mvt.gz\fR, and tile \fB\fCin3z/in3x/in3y\fR of \fB\fCin3.mvt.gz\fR,
|
||||
and produces tile \fB\fCoutz/outx/outy\fR of \fB\fCout.mvt.gz\fR from them.
|
||||
.SS Options
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
|
||||
@@ -109,7 +109,7 @@ int compress(std::string const &input, std::string &output, bool gz) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool mvt_tile::decode(std::string &message, bool &was_compressed) {
|
||||
bool mvt_tile::decode(const std::string &message, bool &was_compressed) {
|
||||
layers.clear();
|
||||
std::string src;
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ struct mvt_tile {
|
||||
std::vector<mvt_layer> layers{};
|
||||
|
||||
std::string encode();
|
||||
bool decode(std::string &message, bool &was_compressed);
|
||||
bool decode(const std::string &message, bool &was_compressed);
|
||||
};
|
||||
|
||||
bool is_compressed(std::string const &data);
|
||||
|
||||
+93
-30
@@ -18,14 +18,26 @@ std::set<std::string> keep;
|
||||
void usage(char **argv) {
|
||||
fprintf(stderr, "Usage: %s -o newtile.pbf.gz tile.pbf.gz oz/ox/oy nz/nx/ny\n", argv[0]);
|
||||
fprintf(stderr, "to create tile nz/nx/ny from tile oz/ox/oy\n");
|
||||
fprintf(stderr, "Usage: %s -o newtile.pbf.gz -t nz/nx/ny tile.pbf.gz oz/ox/oy tile2.pbf.gz oz2/ox2/oy2\n", argv[0]);
|
||||
fprintf(stderr, "to create tile nz/nx/ny from tiles oz/ox/oy and oz2/ox2/oy2\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
struct source {
|
||||
std::string fname;
|
||||
int z;
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
const char *outfile = NULL;
|
||||
const char *outtile = NULL;
|
||||
|
||||
while ((i = getopt(argc, argv, "y:o:d:b:")) != -1) {
|
||||
std::vector<source> sources;
|
||||
|
||||
while ((i = getopt(argc, argv, "y:o:d:b:t:")) != -1) {
|
||||
switch (i) {
|
||||
case 'y':
|
||||
keep.insert(optarg);
|
||||
@@ -43,55 +55,106 @@ int main(int argc, char **argv) {
|
||||
buffer = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
outtile = optarg;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(argv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc - optind != 3) {
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
if (outfile == NULL) {
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
const char *infile = argv[optind + 0];
|
||||
|
||||
int oz, ox, oy;
|
||||
if (sscanf(argv[optind + 1], "%d/%d/%d", &oz, &ox, &oy) != 3) {
|
||||
fprintf(stderr, "%s: not in z/x/y form\n", argv[optind + 1]);
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
std::vector<input_tile> its;
|
||||
int nz, nx, ny;
|
||||
if (sscanf(argv[optind + 2], "%d/%d/%d", &nz, &nx, &ny) != 3) {
|
||||
fprintf(stderr, "%s: not in z/x/y form\n", argv[optind + 2]);
|
||||
usage(argv);
|
||||
|
||||
if (outtile == NULL) { // single input
|
||||
if (argc - optind != 3) {
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
const char *infile = argv[optind + 0];
|
||||
|
||||
int oz, ox, oy;
|
||||
if (sscanf(argv[optind + 1], "%d/%d/%d", &oz, &ox, &oy) != 3) {
|
||||
fprintf(stderr, "%s: not in z/x/y form\n", argv[optind + 1]);
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
if (sscanf(argv[optind + 2], "%d/%d/%d", &nz, &nx, &ny) != 3) {
|
||||
fprintf(stderr, "%s: not in z/x/y form\n", argv[optind + 2]);
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
source s;
|
||||
s.fname = infile;
|
||||
s.z = oz;
|
||||
s.x = ox;
|
||||
s.y = oy;
|
||||
|
||||
sources.push_back(s);
|
||||
} else { // multiple inputs
|
||||
if ((argc - optind) % 2 != 0) {
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
if (sscanf(outtile, "%d/%d/%d", &nz, &nx, &ny) != 3) {
|
||||
fprintf(stderr, "%s: not in z/x/y form\n", outtile);
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
for (i = optind; i + 1 < argc; i += 2) {
|
||||
int oz, ox, oy;
|
||||
if (sscanf(argv[i + 1], "%d/%d/%d", &oz, &ox, &oy) != 3) {
|
||||
fprintf(stderr, "%s: not in z/x/y form\n", argv[i + 1]);
|
||||
usage(argv);
|
||||
}
|
||||
|
||||
source s;
|
||||
s.fname = argv[i];
|
||||
s.z = oz;
|
||||
s.x = ox;
|
||||
s.y = oy;
|
||||
|
||||
sources.push_back(s);
|
||||
}
|
||||
}
|
||||
|
||||
std::string tile;
|
||||
char buf[1000];
|
||||
int len;
|
||||
for (auto const &s : sources) {
|
||||
std::string tile;
|
||||
char buf[1000];
|
||||
int len;
|
||||
|
||||
FILE *f = fopen(infile, "rb");
|
||||
if (f == NULL) {
|
||||
perror(infile);
|
||||
exit(EXIT_FAILURE);
|
||||
FILE *f = fopen(s.fname.c_str(), "rb");
|
||||
if (f == NULL) {
|
||||
perror(s.fname.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while ((len = fread(buf, sizeof(char), 1000, f)) > 0) {
|
||||
tile.append(std::string(buf, len));
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
input_tile it;
|
||||
it.tile = tile;
|
||||
it.z = s.z;
|
||||
it.x = s.x;
|
||||
it.y = s.y;
|
||||
|
||||
its.push_back(it);
|
||||
}
|
||||
|
||||
while ((len = fread(buf, sizeof(char), 1000, f)) > 0) {
|
||||
tile.append(std::string(buf, len));
|
||||
}
|
||||
fclose(f);
|
||||
std::string out = overzoom(its, nz, nx, ny, detail, buffer, keep, true, NULL);
|
||||
|
||||
f = fopen(outfile, "wb");
|
||||
FILE *f = fopen(outfile, "wb");
|
||||
if (f == NULL) {
|
||||
perror(outfile);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
std::string out = overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, true);
|
||||
fwrite(out.c_str(), sizeof(char), out.size(), f);
|
||||
fclose(f);
|
||||
|
||||
|
||||
+5
-2
@@ -328,10 +328,13 @@ static long long scale_geometry(struct serialization_state *sst, long long *bbox
|
||||
if (geom[i].op == VT_LINETO) {
|
||||
x += offset;
|
||||
if (has_prev) {
|
||||
if (x - prev > (1LL << 31)) {
|
||||
// jumps at least 180° but not exactly 360°,
|
||||
// which in some data sets is an intentional
|
||||
// line across the world
|
||||
if (x - prev > (1LL << 31) && x - prev != (1LL << 32)) {
|
||||
offset -= 1LL << 32;
|
||||
x -= 1LL << 32;
|
||||
} else if (prev - x > (1LL << 31)) {
|
||||
} else if (prev - x > (1LL << 31) && prev - x != (1LL << 32)) {
|
||||
offset += 1LL << 32;
|
||||
x += 1LL << 32;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
//
|
||||
|
||||
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
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 13, "x": 1310, "y": 3166 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "ne_10m_land", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "featurecla": "Land", "scalerank": 0, "min_zoom": 0 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.387760, 37.788760 ], [ -122.387094, 37.778754 ], [ -122.386837, 37.778517 ], [ -122.386837, 37.752665 ], [ -122.432499, 37.752665 ], [ -122.432499, 37.788760 ], [ -122.387760, 37.788760 ] ] ] } }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "ne_10m_populated_places", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NATSCALE": 300, "LABELRANK": 1, "FEATURECLA": "Populated place", "NAME": "San Francisco", "NAMEALT": "San Francisco-Oakland", "NAMEASCII": "San Francisco", "ADM0CAP": 0, "WORLDCITY": 1, "MEGACITY": 1, "SOV0NAME": "United States", "SOV_A3": "USA", "ADM0NAME": "United States of America", "ADM0_A3": "USA", "ADM1NAME": "California", "ISO_A2": "US", "LATITUDE": 37.769196, "LONGITUDE": -122.417169, "POP_MAX": 3450000, "POP_MIN": 732072, "POP_OTHER": 27400, "RANK_MAX": 12, "RANK_MIN": 11, "MEGANAME": "San Francisco-Oakland", "LS_NAME": "San Francisco1", "MAX_POP10": 988636, "MAX_POP20": 1130999, "MAX_POP50": 1371285, "MAX_POP300": 4561697, "MAX_POP310": 4561697, "MAX_NATSCA": 300, "MIN_AREAKM": 218, "MAX_AREAKM": 1748, "MIN_AREAMI": 84, "MAX_AREAMI": 675, "MIN_PERKM": 126, "MAX_PERKM": 755, "MIN_PERMI": 78, "MAX_PERMI": 469, "MIN_BBXMIN": -122.516667, "MAX_BBXMIN": -122.516667, "MIN_BBXMAX": -122.358333, "MAX_BBXMAX": -121.733333, "MIN_BBYMIN": 37.191667, "MAX_BBYMIN": 37.575, "MIN_BBYMAX": 37.816667, "MAX_BBYMAX": 38.041667, "MEAN_BBXC": -122.301354, "MEAN_BBYC": 37.622288, "TIMEZONE": "America/Los_Angeles", "UN_FID": 570, "POP1950": 1855, "POP1955": 2021, "POP1960": 2200, "POP1965": 2361, "POP1970": 2529, "POP1975": 2590, "POP1980": 2656, "POP1985": 2805, "POP1990": 2961, "POP1995": 3095, "POP2000": 3236, "POP2005": 3387, "POP2010": 3450, "POP2015": 3544, "POP2020": 3684, "POP2025": 3803, "POP2050": 3898, "MIN_ZOOM": 2.7, "WIKIDATAID": "Q62", "WOF_ID": 85922583, "CAPALT": 0, "NAME_EN": "San Francisco", "NAME_DE": "San Francisco", "NAME_ES": "San Francisco", "NAME_FR": "San Francisco", "NAME_PT": "São Francisco", "NAME_RU": "Сан-Франциско", "NAME_ZH": "旧金山", "NAME_AR": "سان فرانسيسكو", "NAME_BN": "সান ফ্রান্সিস্কো", "NAME_EL": "Σαν Φρανσίσκο", "NAME_HI": "सैन फ्रांसिस्को", "NAME_HU": "San Francisco", "NAME_ID": "San Francisco", "NAME_IT": "San Francisco", "NAME_JA": "サンフランシスコ", "NAME_KO": "샌프란시스코", "NAME_NL": "San Francisco", "NAME_PL": "San Francisco", "NAME_SV": "San Francisco", "NAME_TR": "San Francisco", "NAME_VI": "San Francisco", "NE_ID": 1159151479, "NAME_FA": "سان فرانسیسکو", "NAME_HE": "סן פרנסיסקו", "NAME_UK": "Сан-Франциско", "NAME_UR": "سان فرانسسکو", "NAME_ZHT": "舊金山", "GEONAMESID": 5391959 }, "geometry": { "type": "Point", "coordinates": [ -122.399583, 37.784249 ] } }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "ne_10m_roads", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "scalerank": 4, "featurecla": "Road", "type": "Major Highway", "sov_a3": "USA", "edited": "New in version 2.0.0", "name": "101", "question": 0, "length_km": 11, "toll": 0, "ne_part": "ne_1d4_original", "labelrank": 0, "ignore": 0, "add": 0, "rwdb_rd_id": 0, "orig_fid": 0, "uident": 118705, "continent": "North America", "expressway": 1, "level": "Federal", "min_zoom": 4, "min_label": 7 }, "geometry": { "type": "LineString", "coordinates": [ [ -122.407351, 37.767933 ], [ -122.412586, 37.781841 ], [ -122.419496, 37.788760 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 3, "featurecla": "Road", "type": "Major Highway", "sov_a3": "USA", "edited": "New in version 2.0.0", "name": "80", "question": 0, "length_km": 14, "toll": 1, "ne_part": "ne_1d4_original", "labelrank": 0, "ignore": 0, "add": 0, "rwdb_rd_id": 0, "orig_fid": 0, "uident": 311505, "continent": "North America", "expressway": 1, "level": "Interstate", "min_zoom": 3, "min_label": 6 }, "geometry": { "type": "LineString", "coordinates": [ [ -122.407351, 37.767933 ], [ -122.388253, 37.785300 ], [ -122.386837, 37.786453 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 4, "featurecla": "Road", "type": "Major Highway", "sov_a3": "USA", "edited": "New in version 2.0.0", "name": "280", "question": 0, "length_km": 52, "toll": 0, "ne_part": "ne_1d4_original", "labelrank": 0, "ignore": 0, "add": 0, "rwdb_rd_id": 0, "orig_fid": 0, "uident": 124805, "continent": "North America", "expressway": 1, "level": "Interstate", "min_zoom": 4, "min_label": 7 }, "geometry": { "type": "LineString", "coordinates": [ [ -122.405677, 37.752665 ], [ -122.407351, 37.767933 ] ] } }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "ne_10m_admin_0_countries", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "featurecla": "Admin-0 country", "scalerank": 0, "LABELRANK": 2, "SOVEREIGNT": "United States of America", "SOV_A3": "US1", "ADM0_DIF": 1, "LEVEL": 2, "TYPE": "Country", "TLC": "1", "ADMIN": "United States of America", "ADM0_A3": "USA", "GEOU_DIF": 0, "GEOUNIT": "United States of America", "GU_A3": "USA", "SU_DIF": 0, "SUBUNIT": "United States", "SU_A3": "USA", "BRK_DIFF": 0, "NAME": "United States of America", "NAME_LONG": "United States", "BRK_A3": "USA", "BRK_NAME": "United States", "ABBREV": "U.S.A.", "POSTAL": "US", "FORMAL_EN": "United States of America", "NAME_CIAWF": "United States", "NAME_SORT": "United States of America", "MAPCOLOR7": 4, "MAPCOLOR8": 5, "MAPCOLOR9": 1, "MAPCOLOR13": 1, "POP_EST": 328239523, "POP_RANK": 17, "POP_YEAR": 2019, "GDP_MD": 21433226, "GDP_YEAR": 2019, "ECONOMY": "1. Developed region: G7", "INCOME_GRP": "1. High income: OECD", "FIPS_10": "US", "ISO_A2": "US", "ISO_A2_EH": "US", "ISO_A3": "USA", "ISO_A3_EH": "USA", "ISO_N3": "840", "ISO_N3_EH": "840", "UN_A3": "840", "WB_A2": "US", "WB_A3": "USA", "WOE_ID": 23424977, "WOE_ID_EH": 23424977, "WOE_NOTE": "Exact WOE match as country", "ADM0_ISO": "USA", "ADM0_TLC": "USA", "ADM0_A3_US": "USA", "ADM0_A3_FR": "USA", "ADM0_A3_RU": "USA", "ADM0_A3_ES": "USA", "ADM0_A3_CN": "USA", "ADM0_A3_TW": "USA", "ADM0_A3_IN": "USA", "ADM0_A3_NP": "USA", "ADM0_A3_PK": "USA", "ADM0_A3_DE": "USA", "ADM0_A3_GB": "USA", "ADM0_A3_BR": "USA", "ADM0_A3_IL": "USA", "ADM0_A3_PS": "USA", "ADM0_A3_SA": "USA", "ADM0_A3_EG": "USA", "ADM0_A3_MA": "USA", "ADM0_A3_PT": "USA", "ADM0_A3_AR": "USA", "ADM0_A3_JP": "USA", "ADM0_A3_KO": "USA", "ADM0_A3_VN": "USA", "ADM0_A3_TR": "USA", "ADM0_A3_ID": "USA", "ADM0_A3_PL": "USA", "ADM0_A3_GR": "USA", "ADM0_A3_IT": "USA", "ADM0_A3_NL": "USA", "ADM0_A3_SE": "USA", "ADM0_A3_BD": "USA", "ADM0_A3_UA": "USA", "ADM0_A3_UN": -99, "ADM0_A3_WB": -99, "CONTINENT": "North America", "REGION_UN": "Americas", "SUBREGION": "Northern America", "REGION_WB": "North America", "NAME_LEN": 24, "LONG_LEN": 13, "ABBREV_LEN": 6, "TINY": -99, "HOMEPART": 1, "MIN_ZOOM": 0, "MIN_LABEL": 1.7, "MAX_LABEL": 5.7, "LABEL_X": -97.482602, "LABEL_Y": 39.538479, "NE_ID": 1159321369, "WIKIDATAID": "Q30", "NAME_AR": "الولايات المتحدة", "NAME_BN": "মার্কিন যুক্তরাষ্ট্র", "NAME_DE": "Vereinigte Staaten", "NAME_EN": "United States of America", "NAME_ES": "Estados Unidos", "NAME_FA": "ایالات متحده آمریکا", "NAME_FR": "États-Unis", "NAME_EL": "Ηνωμένες Πολιτείες Αμερικής", "NAME_HE": "ארצות הברית", "NAME_HI": "संयुक्त राज्य अमेरिका", "NAME_HU": "Amerikai Egyesült Államok", "NAME_ID": "Amerika Serikat", "NAME_IT": "Stati Uniti d'America", "NAME_JA": "アメリカ合衆国", "NAME_KO": "미국", "NAME_NL": "Verenigde Staten van Amerika", "NAME_PL": "Stany Zjednoczone", "NAME_PT": "Estados Unidos", "NAME_RU": "США", "NAME_SV": "USA", "NAME_TR": "Amerika Birleşik Devletleri", "NAME_UK": "Сполучені Штати Америки", "NAME_UR": "ریاستہائے متحدہ امریکا", "NAME_VI": "Hoa Kỳ", "NAME_ZH": "美国", "NAME_ZHT": "美國", "FCLASS_ISO": "Admin-0 country", "FCLASS_TLC": "Admin-0 country" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.432499, 37.788081 ], [ -122.386837, 37.788081 ], [ -122.386837, 37.752665 ], [ -122.432499, 37.752665 ], [ -122.432499, 37.788081 ] ] ] } }
|
||||
] }
|
||||
] }
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+51
-6
@@ -54,6 +54,9 @@ int minzoom = 0;
|
||||
std::map<std::string, std::string> renames;
|
||||
bool exclude_all = false;
|
||||
|
||||
size_t stop_after = 0;
|
||||
std::atomic<size_t> tiles_queued_for_write(0);
|
||||
|
||||
bool want_overzoom = false;
|
||||
int buffer = 5;
|
||||
|
||||
@@ -434,7 +437,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 +646,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 +785,16 @@ 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);
|
||||
source_tile st;
|
||||
st.tile = source;
|
||||
st.z = parent_tile.z;
|
||||
st.x = parent_tile.x;
|
||||
st.y = parent_tile.y;
|
||||
|
||||
std::vector<source_tile> sts;
|
||||
sts.push_back(st);
|
||||
|
||||
std::string ret = overzoom(sts, tile.z, tile.x, tile.y, -1, buffer, std::set<std::string>(), false, &next_overzoomed_tiles);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1062,12 +1087,22 @@ void decode(struct tileset_reader *readers, std::map<std::string, layermap_entry
|
||||
// Then this tile is done and we can safely run the output queue.
|
||||
|
||||
if (readers == NULL || readers->zoom != current.first.z || readers->x != current.first.x || readers->y != current.first.y) {
|
||||
tiles_queued_for_write++;
|
||||
if (tasks.size() > 100 * CPUS) {
|
||||
dispatch_tasks(tasks, layermaps, outdb, outdir, header, mapping, exclude, include, ifmatched, keep_layers, remove_layers, filter, readers);
|
||||
tasks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (readers != NULL && readers->zoom != current.first.z && stop_after != 0 && tiles_queued_for_write >= stop_after) {
|
||||
dispatch_tasks(tasks, layermaps, outdb, outdir, header, mapping, exclude, include, ifmatched, keep_layers, remove_layers, filter, readers);
|
||||
tasks.clear();
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "stopping after zoom %lld, after writing %zu tiles\n", current.first.z, (size_t) tiles_queued_for_write);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// put the tileset_reader back onto the queue,
|
||||
// in whatever sequence its next tile calls for
|
||||
|
||||
@@ -1293,6 +1328,7 @@ int main(int argc, char **argv) {
|
||||
{"feature-filter", required_argument, 0, 'j'},
|
||||
{"rename-layer", required_argument, 0, 'R'},
|
||||
{"read-from", required_argument, 0, 'r'},
|
||||
{"stop-after", required_argument, 0, 'a'},
|
||||
|
||||
{"no-tile-size-limit", no_argument, &pk, 1},
|
||||
{"no-tile-compression", no_argument, &pC, 1},
|
||||
@@ -1426,6 +1462,10 @@ int main(int argc, char **argv) {
|
||||
remove_layers.insert(std::string(optarg));
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
stop_after = atoll(optarg);
|
||||
break;
|
||||
|
||||
case 'R': {
|
||||
char *cp = strchr(optarg, ':');
|
||||
if (cp == NULL || cp == optarg) {
|
||||
@@ -1574,6 +1614,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
@@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v2.35.0"
|
||||
#define VERSION "v2.38.0"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user