Compare commits

...
14 changed files with 2773 additions and 147 deletions
+5
View File
@@ -1,3 +1,8 @@
# 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
+17 -1
View File
@@ -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
+7 -1
View File
@@ -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)
+146 -108
View File
@@ -752,143 +752,172 @@ 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,
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) {
mvt_tile tile;
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, next_overzoomed_tiles);
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,
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);
}
}
@@ -903,7 +932,16 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
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,
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) {
+16 -2
View File
@@ -98,11 +98,25 @@ 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,
struct input_tile {
std::string tile;
int z;
int x;
int y;
};
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::string s, int oz, int ox, int oy, int nz, int nx, int ny,
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);
+12 -1
View File
@@ -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
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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
View File
@@ -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, NULL);
fwrite(out.c_str(), sizeof(char), out.size(), f);
fclose(f);
File diff suppressed because one or more lines are too long
Binary file not shown.
+21
View File
@@ -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 ] ] ] } }
] }
] }
+28 -1
View File
@@ -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;
@@ -782,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, &next_overzoomed_tiles);
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;
}
@@ -1075,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
@@ -1306,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},
@@ -1439,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) {
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.37.1"
#define VERSION "v2.38.0"
#endif