mirror of
https://github.com/felt/tippecanoe.git
synced 2026-11-22 16:31:18 +01:00
Compare commits
44
Commits
2.21.0
...
compression
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40075c843a | ||
|
|
40a1022cc3 | ||
|
|
373227e422 | ||
|
|
d271cf233d | ||
|
|
1b176e55c3 | ||
|
|
8713b3a003 | ||
|
|
893f257f8f | ||
|
|
f5366eb767 | ||
|
|
4caa1d2758 | ||
|
|
1b1597f44b | ||
|
|
26d93a1a8d | ||
|
|
34926cf1dc | ||
|
|
c5f18671d8 | ||
|
|
b89cc9f425 | ||
|
|
69ebf3e988 | ||
|
|
5f5ee62a98 | ||
|
|
b155b4671b | ||
|
|
fb7d87145c | ||
|
|
8b0490ba35 | ||
|
|
a7bc8856fe | ||
|
|
98f6be7ebd | ||
|
|
12e3af018b | ||
|
|
5806be8a5b | ||
|
|
a409792fb5 | ||
|
|
da81ad3fed | ||
|
|
a035e4338a | ||
|
|
c7393d8e2e | ||
|
|
484dc27c5e | ||
|
|
21c946dd49 | ||
|
|
4c52aeacf1 | ||
|
|
f1bffd9de0 | ||
|
|
3addc57bfc | ||
|
|
fade093279 | ||
|
|
01aa8358f0 | ||
|
|
1ef0f260f1 | ||
|
|
2695db5ebf | ||
|
|
966fdb63d4 | ||
|
|
da2b5bd9fb | ||
|
|
42e2434cca | ||
|
|
69bf5b324b | ||
|
|
f59f8588eb | ||
|
|
fc8007a2ab | ||
|
|
eef29084ec | ||
|
|
d05f8f8e4c |
@@ -1,3 +1,7 @@
|
||||
## 2.22.0
|
||||
|
||||
* Speed up feature dropping by removing unnecessary search for other small features
|
||||
|
||||
## 2.21.0
|
||||
|
||||
* Improve label placement to avoid placing labels in polygon holes
|
||||
|
||||
@@ -56,7 +56,7 @@ tippecanoe-enumerate: enumerate.o
|
||||
tippecanoe-decode: decode.o projection.o mvt.o write_json.o text.o jsonpull/jsonpull.o dirtiles.o pmtiles_file.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3
|
||||
|
||||
tile-join: tile-join.o projection.o pool.o mbtiles.o mvt.o memfile.o dirtiles.o jsonpull/jsonpull.o text.o evaluator.o csv.o write_json.o pmtiles_file.o
|
||||
tile-join: tile-join.o projection.o mbtiles.o mvt.o memfile.o dirtiles.o jsonpull/jsonpull.o text.o evaluator.o csv.o write_json.o pmtiles_file.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
||||
|
||||
tippecanoe-json-tool: jsontool.o jsonpull/jsonpull.o csv.o text.o geojson-loop.o
|
||||
|
||||
+4
-7
@@ -25,7 +25,7 @@
|
||||
|
||||
static int clip(double *x0, double *y0, double *x1, double *y1, double xmin, double ymin, double xmax, double ymax);
|
||||
|
||||
drawvec decode_geometry(FILE *meta, std::atomic<long long> *geompos, int z, unsigned tx, unsigned ty, long long *bbox, unsigned initial_x, unsigned initial_y) {
|
||||
drawvec decode_geometry(char **meta, int z, unsigned tx, unsigned ty, long long *bbox, unsigned initial_x, unsigned initial_y) {
|
||||
drawvec out;
|
||||
|
||||
bbox[0] = LLONG_MAX;
|
||||
@@ -38,10 +38,7 @@ drawvec decode_geometry(FILE *meta, std::atomic<long long> *geompos, int z, unsi
|
||||
while (1) {
|
||||
draw d;
|
||||
|
||||
if (!deserialize_byte_io(meta, &d.op, geompos)) {
|
||||
fprintf(stderr, "Internal error: Unexpected end of file in geometry\n");
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
deserialize_byte(meta, &d.op);
|
||||
if (d.op == VT_END) {
|
||||
break;
|
||||
}
|
||||
@@ -49,8 +46,8 @@ drawvec decode_geometry(FILE *meta, std::atomic<long long> *geompos, int z, unsi
|
||||
if (d.op == VT_MOVETO || d.op == VT_LINETO) {
|
||||
long long dx, dy;
|
||||
|
||||
deserialize_long_long_io(meta, &dx, geompos);
|
||||
deserialize_long_long_io(meta, &dy, geompos);
|
||||
deserialize_long_long(meta, &dx);
|
||||
deserialize_long_long(meta, &dy);
|
||||
|
||||
wx += dx * (1 << geometry_scale);
|
||||
wy += dy * (1 << geometry_scale);
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ struct draw {
|
||||
typedef std::vector<draw> drawvec;
|
||||
struct serial_feature;
|
||||
|
||||
drawvec decode_geometry(FILE *meta, std::atomic<long long> *geompos, int z, unsigned tx, unsigned ty, long long *bbox, unsigned initial_x, unsigned initial_y);
|
||||
drawvec decode_geometry(char **meta, int z, unsigned tx, unsigned ty, long long *bbox, unsigned initial_x, unsigned initial_y);
|
||||
void to_tile_scale(drawvec &geom, int z, int detail);
|
||||
drawvec from_tile_scale(drawvec const &geom, int z, int detail);
|
||||
drawvec remove_noop(drawvec geom, int type, int shift);
|
||||
|
||||
@@ -105,6 +105,7 @@ struct source {
|
||||
size_t CPUS;
|
||||
size_t TEMP_FILES;
|
||||
long long MAX_FILES;
|
||||
size_t memsize;
|
||||
static long long diskfree;
|
||||
char **av;
|
||||
|
||||
@@ -113,9 +114,9 @@ std::vector<clipbbox> clipbboxes;
|
||||
void checkdisk(std::vector<struct reader> *r) {
|
||||
long long used = 0;
|
||||
for (size_t i = 0; i < r->size(); i++) {
|
||||
// Meta, pool, and tree are used once.
|
||||
// Pool and tree are used once.
|
||||
// Geometry and index will be duplicated during sorting and tiling.
|
||||
used += (*r)[i].metapos + 2 * (*r)[i].geompos + 2 * (*r)[i].indexpos + (*r)[i].poolfile->len + (*r)[i].treefile->len;
|
||||
used += 2 * (*r)[i].geompos + 2 * (*r)[i].indexpos + (*r)[i].poolfile->off + (*r)[i].treefile->off;
|
||||
}
|
||||
|
||||
static int warned = 0;
|
||||
@@ -326,8 +327,11 @@ static void merge(struct mergelist *merges, size_t nmerges, unsigned char *map,
|
||||
while (head != NULL) {
|
||||
struct index ix = *((struct index *) (map + head->start));
|
||||
long long pos = *geompos;
|
||||
fwrite_check(geom_map + ix.start, 1, ix.end - ix.start, geom_out, "merge geometry");
|
||||
*geompos += ix.end - ix.start;
|
||||
|
||||
// MAGIC: This knows that the feature minzoom is the last byte of the serialized feature
|
||||
// and is writing one byte less and then adding the byte for the minzoom.
|
||||
|
||||
fwrite_check(geom_map + ix.start, 1, ix.end - ix.start - 1, geom_out, geompos, "merge geometry");
|
||||
int feature_minzoom = calc_feature_minzoom(&ix, ds, maxzoom, gamma);
|
||||
serialize_byte(geom_out, feature_minzoom, geompos, "merge geometry");
|
||||
|
||||
@@ -335,12 +339,14 @@ static void merge(struct mergelist *merges, size_t nmerges, unsigned char *map,
|
||||
*progress += (ix.end - ix.start) * 3 / 4;
|
||||
if (!quiet && !quiet_progress && progress_time() && 100 * *progress / *progress_max != *progress_reported) {
|
||||
fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max);
|
||||
fflush(stderr);
|
||||
*progress_reported = 100 * *progress / *progress_max;
|
||||
}
|
||||
|
||||
ix.start = pos;
|
||||
ix.end = *geompos;
|
||||
fwrite_check(&ix, bytes, 1, indexfile, "merge temporary");
|
||||
std::atomic<long long> indexpos;
|
||||
fwrite_check(&ix, bytes, 1, indexfile, &indexpos, "merge temporary");
|
||||
head->start += bytes;
|
||||
|
||||
struct mergelist *m = head;
|
||||
@@ -382,32 +388,25 @@ void *run_sort(void *v) {
|
||||
a->merges[start / a->unit].end = end;
|
||||
a->merges[start / a->unit].next = NULL;
|
||||
|
||||
// MAP_PRIVATE to avoid disk writes if it fits in memory
|
||||
void *map = mmap(NULL, end - start, PROT_READ | PROT_WRITE, MAP_PRIVATE, a->indexfd, start);
|
||||
if (map == MAP_FAILED) {
|
||||
perror("mmap in run_sort");
|
||||
exit(EXIT_MEMORY);
|
||||
// Read section of index into memory to sort and then use pwrite()
|
||||
// to write it back out rather than sorting in mapped memory,
|
||||
// because writable mapped memory seems to have bad performance
|
||||
// problems on ECS (and maybe in containers in general)?
|
||||
|
||||
std::string s;
|
||||
s.resize(end - start);
|
||||
|
||||
if (pread(a->indexfd, (void *) s.c_str(), end - start, start) != end - start) {
|
||||
fprintf(stderr, "pread(index): %s\n", strerror(errno));
|
||||
exit(EXIT_READ);
|
||||
}
|
||||
madvise(map, end - start, MADV_RANDOM);
|
||||
madvise(map, end - start, MADV_WILLNEED);
|
||||
|
||||
qsort(map, (end - start) / a->bytes, a->bytes, indexcmp);
|
||||
qsort((void *) s.c_str(), (end - start) / a->bytes, a->bytes, indexcmp);
|
||||
|
||||
// Sorting and then copying avoids disk access to
|
||||
// write out intermediate stages of the sort.
|
||||
|
||||
void *map2 = mmap(NULL, end - start, PROT_READ | PROT_WRITE, MAP_SHARED, a->indexfd, start);
|
||||
if (map2 == MAP_FAILED) {
|
||||
perror("mmap (write)");
|
||||
exit(EXIT_MEMORY);
|
||||
if (pwrite(a->indexfd, s.c_str(), end - start, start) != end - start) {
|
||||
fprintf(stderr, "pwrite(index): %s\n", strerror(errno));
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
madvise(map2, end - start, MADV_SEQUENTIAL);
|
||||
|
||||
memcpy(map2, map, end - start);
|
||||
|
||||
// No madvise, since caller will want the sorted data
|
||||
munmap(map, end - start);
|
||||
munmap(map2, end - start);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -788,20 +787,21 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
|
||||
unsigned long long which = (ix.ix << prefix) >> (64 - splitbits);
|
||||
long long pos = sub_geompos[which];
|
||||
|
||||
fwrite_check(geommap + ix.start, ix.end - ix.start, 1, geomfiles[which], "geom");
|
||||
sub_geompos[which] += ix.end - ix.start;
|
||||
fwrite_check(geommap + ix.start, ix.end - ix.start, 1, geomfiles[which], &sub_geompos[which], "geom");
|
||||
|
||||
// Count this as a 25%-accomplishment, since we will copy again
|
||||
*progress += (ix.end - ix.start) / 4;
|
||||
if (!quiet && !quiet_progress && progress_time() && 100 * *progress / *progress_max != *progress_reported) {
|
||||
fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max);
|
||||
fflush(stderr);
|
||||
*progress_reported = 100 * *progress / *progress_max;
|
||||
}
|
||||
|
||||
ix.start = pos;
|
||||
ix.end = sub_geompos[which];
|
||||
|
||||
fwrite_check(&ix, sizeof(struct index), 1, indexfiles[which], "index");
|
||||
std::atomic<long long> indexpos;
|
||||
fwrite_check(&ix, sizeof(struct index), 1, indexfiles[which], &indexpos, "index");
|
||||
}
|
||||
|
||||
madvise(indexmap, indexst.st_size, MADV_DONTNEED);
|
||||
@@ -958,8 +958,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
|
||||
struct index ix = indexmap[a];
|
||||
long long pos = *geompos_out;
|
||||
|
||||
fwrite_check(geommap + ix.start, ix.end - ix.start, 1, geomfile, "geom");
|
||||
*geompos_out += ix.end - ix.start;
|
||||
fwrite_check(geommap + ix.start, ix.end - ix.start, 1, geomfile, geompos_out, "geom");
|
||||
int feature_minzoom = calc_feature_minzoom(&ix, ds, maxzoom, gamma);
|
||||
serialize_byte(geomfile, feature_minzoom, geompos_out, "merge geometry");
|
||||
|
||||
@@ -967,12 +966,14 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
|
||||
*progress += (ix.end - ix.start) * 3 / 4;
|
||||
if (!quiet && !quiet_progress && progress_time() && 100 * *progress / *progress_max != *progress_reported) {
|
||||
fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max);
|
||||
fflush(stderr);
|
||||
*progress_reported = 100 * *progress / *progress_max;
|
||||
}
|
||||
|
||||
ix.start = pos;
|
||||
ix.end = *geompos_out;
|
||||
fwrite_check(&ix, sizeof(struct index), 1, indexfile, "index");
|
||||
std::atomic<long long> indexpos;
|
||||
fwrite_check(&ix, sizeof(struct index), 1, indexfile, &indexpos, "index");
|
||||
}
|
||||
|
||||
madvise(indexmap, indexst.st_size, MADV_DONTNEED);
|
||||
@@ -1028,17 +1029,8 @@ void prep_drop_states(struct drop_state *ds, int maxzoom, int basezoom, double d
|
||||
}
|
||||
}
|
||||
|
||||
void radix(std::vector<struct reader> &readers, int nreaders, FILE *geomfile, FILE *indexfile, const char *tmpdir, std::atomic<long long> *geompos, int maxzoom, int basezoom, double droprate, double gamma) {
|
||||
// Run through the index and geometry for each reader,
|
||||
// splitting the contents out by index into as many
|
||||
// sub-files as we can write to simultaneously.
|
||||
|
||||
// Then sort each of those by index, recursively if it is
|
||||
// too big to fit in memory.
|
||||
|
||||
// Then concatenate each of the sub-outputs into a final output.
|
||||
|
||||
long long mem;
|
||||
static size_t calc_memsize() {
|
||||
size_t mem;
|
||||
|
||||
#ifdef __APPLE__
|
||||
int64_t hw_memsize;
|
||||
@@ -1059,6 +1051,21 @@ void radix(std::vector<struct reader> &readers, int nreaders, FILE *geomfile, FI
|
||||
mem = (long long) pages * pagesize;
|
||||
#endif
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
void radix(std::vector<struct reader> &readers, int nreaders, FILE *geomfile, FILE *indexfile, const char *tmpdir, std::atomic<long long> *geompos, int maxzoom, int basezoom, double droprate, double gamma) {
|
||||
// Run through the index and geometry for each reader,
|
||||
// splitting the contents out by index into as many
|
||||
// sub-files as we can write to simultaneously.
|
||||
|
||||
// Then sort each of those by index, recursively if it is
|
||||
// too big to fit in memory.
|
||||
|
||||
// Then concatenate each of the sub-outputs into a final output.
|
||||
|
||||
long long mem = memsize;
|
||||
|
||||
// Just for code coverage testing. Deeply recursive sorting is very slow
|
||||
// compared to sorting in memory.
|
||||
if (additional[A_PREFER_RADIX_SORT]) {
|
||||
@@ -1066,7 +1073,7 @@ void radix(std::vector<struct reader> &readers, int nreaders, FILE *geomfile, FI
|
||||
}
|
||||
|
||||
long long availfiles = MAX_FILES - 2 * nreaders // each reader has a geom and an index
|
||||
- 4 // pool, meta, mbtiles, mbtiles journal
|
||||
- 3 // pool, mbtiles, mbtiles journal
|
||||
- 4 // top-level geom and index output, both FILE and fd
|
||||
- 3; // stdin, stdout, stderr
|
||||
|
||||
@@ -1164,23 +1171,16 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
struct reader *r = &readers[i];
|
||||
|
||||
char metaname[strlen(tmpdir) + strlen("/meta.XXXXXXXX") + 1];
|
||||
char poolname[strlen(tmpdir) + strlen("/pool.XXXXXXXX") + 1];
|
||||
char treename[strlen(tmpdir) + strlen("/tree.XXXXXXXX") + 1];
|
||||
char geomname[strlen(tmpdir) + strlen("/geom.XXXXXXXX") + 1];
|
||||
char indexname[strlen(tmpdir) + strlen("/index.XXXXXXXX") + 1];
|
||||
|
||||
sprintf(metaname, "%s%s", tmpdir, "/meta.XXXXXXXX");
|
||||
sprintf(poolname, "%s%s", tmpdir, "/pool.XXXXXXXX");
|
||||
sprintf(treename, "%s%s", tmpdir, "/tree.XXXXXXXX");
|
||||
sprintf(geomname, "%s%s", tmpdir, "/geom.XXXXXXXX");
|
||||
sprintf(indexname, "%s%s", tmpdir, "/index.XXXXXXXX");
|
||||
|
||||
r->metafd = mkstemp_cloexec(metaname);
|
||||
if (r->metafd < 0) {
|
||||
perror(metaname);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
r->poolfd = mkstemp_cloexec(poolname);
|
||||
if (r->poolfd < 0) {
|
||||
perror(poolname);
|
||||
@@ -1202,11 +1202,6 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
r->metafile = fopen_oflag(metaname, "wb", O_WRONLY | O_CLOEXEC);
|
||||
if (r->metafile == NULL) {
|
||||
perror(metaname);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
r->poolfile = memfile_open(r->poolfd);
|
||||
if (r->poolfile == NULL) {
|
||||
perror(poolname);
|
||||
@@ -1227,11 +1222,9 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
perror(indexname);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
r->metapos = 0;
|
||||
r->geompos = 0;
|
||||
r->indexpos = 0;
|
||||
|
||||
unlink(metaname);
|
||||
unlink(poolname);
|
||||
unlink(treename);
|
||||
unlink(geomname);
|
||||
@@ -1242,8 +1235,6 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
struct stringpool p;
|
||||
memfile_write(r->treefile, &p, sizeof(struct stringpool));
|
||||
}
|
||||
// Keep metadata file from being completely empty if no attributes
|
||||
serialize_int(r->metafile, 0, &r->metapos, "meta");
|
||||
|
||||
r->file_bbox[0] = r->file_bbox[1] = UINT_MAX;
|
||||
r->file_bbox[2] = r->file_bbox[3] = 0;
|
||||
@@ -1674,7 +1665,8 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
int n;
|
||||
|
||||
while ((n = fp->read(buf, READ_BUF)) > 0) {
|
||||
fwrite_check(buf, sizeof(char), n, readfp, reading.c_str());
|
||||
std::atomic<long long> readingpos;
|
||||
fwrite_check(buf, sizeof(char), n, readfp, &readingpos, reading.c_str());
|
||||
ahead += n;
|
||||
|
||||
if (buf[n - 1] == read_parallel_this && ahead > PARSE_MIN) {
|
||||
@@ -1803,13 +1795,10 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
if (!quiet) {
|
||||
fprintf(stderr, " \r");
|
||||
// (stderr, "Read 10000.00 million features\r", *progress_seq / 1000000.0);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
if (fclose(readers[i].metafile) != 0) {
|
||||
perror("fclose meta");
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
if (fclose(readers[i].geomfile) != 0) {
|
||||
perror("fclose geom");
|
||||
exit(EXIT_CLOSE);
|
||||
@@ -1824,21 +1813,16 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
perror("stat geom\n");
|
||||
exit(EXIT_STAT);
|
||||
}
|
||||
if (fstat(readers[i].metafd, &readers[i].metast) != 0) {
|
||||
perror("stat meta\n");
|
||||
exit(EXIT_STAT);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a combined string pool and a combined metadata file
|
||||
// Create a combined string pool
|
||||
// but keep track of the offsets into it since we still need
|
||||
// segment+offset to find the data.
|
||||
|
||||
// 2 * CPUS: One per input thread, one per tiling thread
|
||||
long long pool_off[2 * CPUS];
|
||||
long long meta_off[2 * CPUS];
|
||||
for (size_t i = 0; i < 2 * CPUS; i++) {
|
||||
pool_off[i] = meta_off[i] = 0;
|
||||
pool_off[i] = 0;
|
||||
}
|
||||
|
||||
char poolname[strlen(tmpdir) + strlen("/pool.XXXXXXXX") + 1];
|
||||
@@ -1858,60 +1842,51 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
|
||||
unlink(poolname);
|
||||
|
||||
char metaname[strlen(tmpdir) + strlen("/meta.XXXXXXXX") + 1];
|
||||
sprintf(metaname, "%s%s", tmpdir, "/meta.XXXXXXXX");
|
||||
|
||||
int metafd = mkstemp_cloexec(metaname);
|
||||
if (metafd < 0) {
|
||||
perror(metaname);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
FILE *metafile = fopen_oflag(metaname, "wb", O_WRONLY | O_CLOEXEC);
|
||||
if (metafile == NULL) {
|
||||
perror(metaname);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
unlink(metaname);
|
||||
|
||||
std::atomic<long long> metapos(0);
|
||||
std::atomic<long long> poolpos(0);
|
||||
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
if (readers[i].metapos > 0) {
|
||||
void *map = mmap(NULL, readers[i].metapos, PROT_READ, MAP_PRIVATE, readers[i].metafd, 0);
|
||||
if (map == MAP_FAILED) {
|
||||
perror("mmap unmerged meta");
|
||||
// If the memfile is not done yet, it is in memory, so just copy the memory.
|
||||
// Otherwise, we need to merge memory and file.
|
||||
|
||||
if (readers[i].poolfile->fp == NULL) {
|
||||
// still in memory
|
||||
|
||||
if (readers[i].poolfile->map.size() > 0) {
|
||||
if (fwrite(readers[i].poolfile->map.c_str(), readers[i].poolfile->map.size(), 1, poolfile) != 1) {
|
||||
perror("Reunify string pool");
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
pool_off[i] = poolpos;
|
||||
poolpos += readers[i].poolfile->map.size();
|
||||
} else {
|
||||
// split into memory and file
|
||||
|
||||
if (fflush(readers[i].poolfile->fp) != 0) {
|
||||
perror("fflush poolfile");
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
|
||||
char *s = (char *) mmap(NULL, readers[i].poolfile->off, PROT_READ, MAP_PRIVATE, readers[i].poolfile->fd, 0);
|
||||
if (s == MAP_FAILED) {
|
||||
perror("mmap string pool for copy");
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
madvise(map, readers[i].metapos, MADV_SEQUENTIAL);
|
||||
madvise(map, readers[i].metapos, MADV_WILLNEED);
|
||||
if (fwrite(map, readers[i].metapos, 1, metafile) != 1) {
|
||||
perror("Reunify meta");
|
||||
madvise(s, readers[i].poolfile->off, MADV_SEQUENTIAL);
|
||||
if (fwrite(s, sizeof(char), readers[i].poolfile->off, poolfile) != readers[i].poolfile->off) {
|
||||
perror("Reunify string pool (split)");
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
madvise(map, readers[i].metapos, MADV_DONTNEED);
|
||||
if (munmap(map, readers[i].metapos) != 0) {
|
||||
perror("unmap unmerged meta");
|
||||
if (munmap(s, readers[i].poolfile->off) != 0) {
|
||||
perror("unmap string pool for copy");
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
|
||||
pool_off[i] = poolpos;
|
||||
poolpos += readers[i].poolfile->off;
|
||||
}
|
||||
|
||||
meta_off[i] = metapos;
|
||||
metapos += readers[i].metapos;
|
||||
if (close(readers[i].metafd) != 0) {
|
||||
perror("close unmerged meta");
|
||||
}
|
||||
|
||||
if (readers[i].poolfile->off > 0) {
|
||||
if (fwrite(readers[i].poolfile->map, readers[i].poolfile->off, 1, poolfile) != 1) {
|
||||
perror("Reunify string pool");
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
pool_off[i] = poolpos;
|
||||
poolpos += readers[i].poolfile->off;
|
||||
memfile_close(readers[i].poolfile);
|
||||
}
|
||||
|
||||
@@ -1919,17 +1894,6 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
perror("fclose pool");
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
if (fclose(metafile) != 0) {
|
||||
perror("fclose meta");
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
|
||||
char *meta = (char *) mmap(NULL, metapos, PROT_READ, MAP_PRIVATE, metafd, 0);
|
||||
if (meta == MAP_FAILED) {
|
||||
perror("mmap meta");
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
madvise(meta, metapos, MADV_RANDOM);
|
||||
|
||||
char *stringpool = NULL;
|
||||
if (poolpos > 0) { // Will be 0 if -X was specified
|
||||
@@ -1983,7 +1947,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
|
||||
std::atomic<long long> geompos(0);
|
||||
|
||||
/* initial tile is 0/0/0 */
|
||||
/* initial tile is normally 0/0/0 but can be iz/ix/iy if limited to one tile */
|
||||
serialize_int(geomfile, iz, &geompos, fname);
|
||||
serialize_uint(geomfile, ix, &geompos, fname);
|
||||
serialize_uint(geomfile, iy, &geompos, fname);
|
||||
@@ -1991,7 +1955,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
radix(readers, CPUS, geomfile, indexfile, tmpdir, &geompos, maxzoom, basezoom, droprate, gamma);
|
||||
|
||||
/* end of tile */
|
||||
serialize_byte(geomfile, -2, &geompos, fname);
|
||||
serialize_ulong_long(geomfile, 0, &geompos, fname); // EOF
|
||||
|
||||
if (fclose(geomfile) != 0) {
|
||||
perror("fclose geom");
|
||||
@@ -2014,9 +1978,8 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
if (!quiet) {
|
||||
long long s = progress_seq;
|
||||
long long geompos_print = geompos;
|
||||
long long metapos_print = metapos;
|
||||
long long poolpos_print = poolpos;
|
||||
fprintf(stderr, "%lld features, %lld bytes of geometry, %lld bytes of separate metadata, %lld bytes of string pool\n", s, geompos_print, metapos_print, poolpos_print);
|
||||
fprintf(stderr, "%lld features, %lld bytes of geometry, %lld bytes of string pool\n", s, geompos_print, poolpos_print);
|
||||
}
|
||||
|
||||
if (indexpos == 0) {
|
||||
@@ -2083,6 +2046,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
progress = nprogress;
|
||||
if (!quiet && !quiet_progress && progress_time()) {
|
||||
fprintf(stderr, "Maxzoom: %lld%% \r", progress);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2269,6 +2233,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
progress = nprogress;
|
||||
if (!quiet && !quiet_progress && progress_time()) {
|
||||
fprintf(stderr, "Base zoom/drop rate: %lld%% \r", progress);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2518,7 +2483,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
std::atomic<unsigned> midx(0);
|
||||
std::atomic<unsigned> midy(0);
|
||||
std::vector<strategy> strategies;
|
||||
int written = traverse_zooms(fd, size, meta, stringpool, &midx, &midy, maxzoom, minzoom, outdb, outdir, buffer, fname, tmpdir, gamma, full_detail, low_detail, min_detail, meta_off, pool_off, initial_x, initial_y, simplification, maxzoom_simplification, layermaps, prefilter, postfilter, attribute_accum, filter, strategies);
|
||||
int written = traverse_zooms(fd, size, stringpool, &midx, &midy, maxzoom, minzoom, outdb, outdir, buffer, fname, tmpdir, gamma, full_detail, low_detail, min_detail, pool_off, initial_x, initial_y, simplification, maxzoom_simplification, layermaps, prefilter, postfilter, attribute_accum, filter, strategies, iz);
|
||||
|
||||
if (maxzoom != written) {
|
||||
if (written > minzoom) {
|
||||
@@ -2531,14 +2496,6 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
}
|
||||
}
|
||||
|
||||
madvise(meta, metapos, MADV_DONTNEED);
|
||||
if (munmap(meta, metapos) != 0) {
|
||||
perror("munmap meta");
|
||||
}
|
||||
if (close(metafd) < 0) {
|
||||
perror("close meta");
|
||||
}
|
||||
|
||||
if (poolpos > 0) {
|
||||
madvise((void *) stringpool, poolpos, MADV_DONTNEED);
|
||||
if (munmap(stringpool, poolpos) != 0) {
|
||||
@@ -2745,6 +2702,8 @@ int main(int argc, char **argv) {
|
||||
int files_open_at_start;
|
||||
json_object *filter = NULL;
|
||||
|
||||
memsize = calc_memsize();
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
prevent[i] = 0;
|
||||
additional[i] = 0;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <stddef.h>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "json_logger.hpp"
|
||||
|
||||
@@ -47,6 +48,7 @@ extern int extra_detail;
|
||||
|
||||
extern size_t CPUS;
|
||||
extern size_t TEMP_FILES;
|
||||
extern size_t memsize;
|
||||
|
||||
extern size_t max_tile_size;
|
||||
extern size_t max_tile_features;
|
||||
|
||||
+48
-29
@@ -12,33 +12,34 @@ struct memfile *memfile_open(int fd) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *map = (char *) mmap(NULL, INITIAL, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (map == MAP_FAILED) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct memfile *mf = new memfile;
|
||||
if (mf == NULL) {
|
||||
munmap(map, INITIAL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mf->fd = fd;
|
||||
mf->map = map;
|
||||
mf->len = INITIAL;
|
||||
mf->off = 0;
|
||||
mf->tree = 0;
|
||||
mf->off = 0;
|
||||
|
||||
return mf;
|
||||
}
|
||||
|
||||
int memfile_close(struct memfile *file) {
|
||||
if (munmap(file->map, file->len) != 0) {
|
||||
return -1;
|
||||
}
|
||||
// If it isn't full yet, flush out the string to the file now.
|
||||
// If it is full, close out the buffered file writer.
|
||||
|
||||
if (file->fd >= 0) {
|
||||
if (close(file->fd) != 0) {
|
||||
if (file->fp == NULL) {
|
||||
if (write(file->fd, file->map.c_str(), file->map.size()) != (ssize_t) file->map.size()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (file->fd >= 0) {
|
||||
if (close(file->fd) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (fclose(file->fp) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -48,24 +49,42 @@ int memfile_close(struct memfile *file) {
|
||||
}
|
||||
|
||||
int memfile_write(struct memfile *file, void *s, long long len) {
|
||||
if (file->off + len > file->len) {
|
||||
if (munmap(file->map, file->len) != 0) {
|
||||
return -1;
|
||||
}
|
||||
// If it is full, append to the file.
|
||||
// If it is not full yet, append to the string in memory.
|
||||
|
||||
file->len += (len + INCREMENT + 1) / INCREMENT * INCREMENT;
|
||||
|
||||
if (ftruncate(file->fd, file->len) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
file->map = (char *) mmap(NULL, file->len, PROT_READ | PROT_WRITE, MAP_SHARED, file->fd, 0);
|
||||
if (file->map == MAP_FAILED) {
|
||||
return -1;
|
||||
if (file->fp != NULL) {
|
||||
if (fwrite(s, sizeof(char), len, file->fp) != (size_t) len) {
|
||||
return 0;
|
||||
}
|
||||
file->off += len;
|
||||
} else {
|
||||
file->map.append(std::string((char *) s, len));
|
||||
file->off += len;
|
||||
}
|
||||
|
||||
memcpy(file->map + file->off, s, len);
|
||||
file->off += len;
|
||||
return len;
|
||||
}
|
||||
|
||||
void memfile_full(struct memfile *file) {
|
||||
// The file is full. Write out a copy of whatever has accumulated in memory
|
||||
// to the file, and switch to appending to the file. Existing references
|
||||
// into the memory still work.
|
||||
|
||||
if (file->fp != NULL) {
|
||||
fprintf(stderr, "memfile marked full twice\n");
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Tippecanoe string pool is full (%zu); switching to file\n", file->off);
|
||||
|
||||
file->fp = fdopen(file->fd, "wb");
|
||||
if (file->fp == NULL) {
|
||||
fprintf(stderr, "fdopen memfile: %s\n", strerror(errno));
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
if (fwrite(file->map.c_str(), sizeof(char), file->map.size(), file->fp) != file->map.size()) {
|
||||
fprintf(stderr, "memfile write: %s\n", strerror(errno));
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -2,21 +2,20 @@
|
||||
#define MEMFILE_HPP
|
||||
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include "errors.hpp"
|
||||
|
||||
struct memfile {
|
||||
int fd = 0;
|
||||
char *map = NULL;
|
||||
std::atomic<long long> len;
|
||||
long long off = 0;
|
||||
std::string map;
|
||||
unsigned long tree = 0;
|
||||
|
||||
memfile()
|
||||
: len(0) {
|
||||
}
|
||||
FILE *fp = NULL;
|
||||
size_t off = 0;
|
||||
};
|
||||
|
||||
struct memfile *memfile_open(int fd);
|
||||
int memfile_close(struct memfile *file);
|
||||
int memfile_write(struct memfile *file, void *s, long long len);
|
||||
void memfile_full(struct memfile *file);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -82,14 +82,14 @@ int decompress(std::string const &input, std::string &output) {
|
||||
}
|
||||
|
||||
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
|
||||
int compress(std::string const &input, std::string &output) {
|
||||
int compress(std::string const &input, std::string &output, bool gz) {
|
||||
z_stream deflate_s;
|
||||
deflate_s.zalloc = Z_NULL;
|
||||
deflate_s.zfree = Z_NULL;
|
||||
deflate_s.opaque = Z_NULL;
|
||||
deflate_s.avail_in = 0;
|
||||
deflate_s.next_in = Z_NULL;
|
||||
deflateInit2(&deflate_s, Z_BEST_COMPRESSION, Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY);
|
||||
deflateInit2(&deflate_s, Z_BEST_COMPRESSION, Z_DEFLATED, gz ? 31 : 15, 8, Z_DEFAULT_STRATEGY);
|
||||
deflate_s.next_in = (Bytef *) input.data();
|
||||
deflate_s.avail_in = input.size();
|
||||
size_t length = 0;
|
||||
|
||||
@@ -115,7 +115,7 @@ struct mvt_tile {
|
||||
|
||||
bool is_compressed(std::string const &data);
|
||||
int decompress(std::string const &input, std::string &output);
|
||||
int compress(std::string const &input, std::string &output);
|
||||
int compress(std::string const &input, std::string &output, bool gz);
|
||||
int dezig(unsigned n);
|
||||
|
||||
mvt_value stringified_to_mvt_value(int type, const char *s);
|
||||
|
||||
@@ -405,7 +405,6 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std::
|
||||
sf.bbox[0] = sf.bbox[1] = LLONG_MAX;
|
||||
sf.bbox[2] = sf.bbox[3] = LLONG_MIN;
|
||||
sf.extent = 0;
|
||||
sf.metapos = 0;
|
||||
sf.has_id = false;
|
||||
|
||||
std::string layername = "unknown";
|
||||
|
||||
+3
-2
@@ -57,7 +57,7 @@ std::string compress_fn(const std::string &input, uint8_t compression) {
|
||||
if (compression == pmtiles::COMPRESSION_NONE) {
|
||||
output = input;
|
||||
} else if (compression == pmtiles::COMPRESSION_GZIP) {
|
||||
compress(input, output);
|
||||
compress(input, output, true);
|
||||
} else {
|
||||
throw std::runtime_error("Unknown or unsupported compression.");
|
||||
}
|
||||
@@ -121,7 +121,7 @@ std::string metadata_to_pmtiles_json(metadata m) {
|
||||
state.json_end_hash();
|
||||
state.json_write_newline();
|
||||
std::string compressed;
|
||||
compress(buf, compressed);
|
||||
compress(buf, compressed, true);
|
||||
return compressed;
|
||||
}
|
||||
|
||||
@@ -200,6 +200,7 @@ void mbtiles_map_image_to_pmtiles(char *fname, metadata m, bool tile_compression
|
||||
pmtiles::zxy zxy = pmtiles::tileid_to_zxy(tile_id);
|
||||
if (!quiet && !quiet_progress) {
|
||||
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, zxy.z, zxy.x, zxy.y);
|
||||
fflush(stderr);
|
||||
}
|
||||
sqlite3_bind_int(map_stmt, 1, zxy.z);
|
||||
sqlite3_bind_int(map_stmt, 2, zxy.x);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include "main.hpp"
|
||||
#include "memfile.hpp"
|
||||
#include "pool.hpp"
|
||||
#include "errors.hpp"
|
||||
@@ -42,24 +43,26 @@ long long addpool(struct memfile *poolfile, struct memfile *treefile, const char
|
||||
}
|
||||
|
||||
while (*sp != 0) {
|
||||
int cmp = swizzlecmp(s, poolfile->map + ((struct stringpool *) (treefile->map + *sp))->off + 1);
|
||||
int cmp = swizzlecmp(s, poolfile->map.c_str() + ((struct stringpool *) (treefile->map.c_str() + *sp))->off + 1);
|
||||
|
||||
if (cmp == 0) {
|
||||
cmp = type - (poolfile->map + ((struct stringpool *) (treefile->map + *sp))->off)[0];
|
||||
cmp = type - (poolfile->map.c_str() + ((struct stringpool *) (treefile->map.c_str() + *sp))->off)[0];
|
||||
}
|
||||
|
||||
if (cmp < 0) {
|
||||
sp = &(((struct stringpool *) (treefile->map + *sp))->left);
|
||||
sp = &(((struct stringpool *) (treefile->map.c_str() + *sp))->left);
|
||||
} else if (cmp > 0) {
|
||||
sp = &(((struct stringpool *) (treefile->map + *sp))->right);
|
||||
sp = &(((struct stringpool *) (treefile->map.c_str() + *sp))->right);
|
||||
} else {
|
||||
return ((struct stringpool *) (treefile->map + *sp))->off;
|
||||
return ((struct stringpool *) (treefile->map.c_str() + *sp))->off;
|
||||
}
|
||||
|
||||
depth++;
|
||||
if (depth > max) {
|
||||
// Search is very deep, so string is probably unique.
|
||||
// Add it to the pool without adding it to the search tree.
|
||||
// This might go either to memory or the file, depending on whether
|
||||
// the pool is full yet.
|
||||
|
||||
long long off = poolfile->off;
|
||||
if (memfile_write(poolfile, &type, 1) < 0) {
|
||||
@@ -74,12 +77,41 @@ long long addpool(struct memfile *poolfile, struct memfile *treefile, const char
|
||||
}
|
||||
}
|
||||
|
||||
// Size of memory divided by 10 from observation of OOM errors (when supposedly
|
||||
// 20% of memory is full) and onset of thrashing (when supposedly 15% of memory
|
||||
// is full) on ECS.
|
||||
if ((size_t) (poolfile->off + treefile->off) > memsize / CPUS / 10) {
|
||||
// If the pool and search tree get to be larger than physical memory,
|
||||
// then searching will start thrashing. Switch to appending strings
|
||||
// to the file instead of keeping them in memory.
|
||||
|
||||
if (poolfile->fp == NULL) {
|
||||
memfile_full(poolfile);
|
||||
}
|
||||
}
|
||||
|
||||
if (poolfile->fp != NULL) {
|
||||
// We are now appending to the file, so don't try to keep tree references
|
||||
// to the newly-added strings.
|
||||
|
||||
long long off = poolfile->off;
|
||||
if (memfile_write(poolfile, &type, 1) < 0) {
|
||||
perror("memfile write");
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
if (memfile_write(poolfile, (void *) s, strlen(s) + 1) < 0) {
|
||||
perror("memfile write");
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
return off;
|
||||
}
|
||||
|
||||
// *sp is probably in the memory-mapped file, and will move if the file grows.
|
||||
long long ssp;
|
||||
if (sp == &treefile->tree) {
|
||||
ssp = -1;
|
||||
} else {
|
||||
ssp = ((char *) sp) - treefile->map;
|
||||
ssp = ((char *) sp) - treefile->map.c_str();
|
||||
}
|
||||
|
||||
long long off = poolfile->off;
|
||||
@@ -116,7 +148,7 @@ long long addpool(struct memfile *poolfile, struct memfile *treefile, const char
|
||||
if (ssp == -1) {
|
||||
treefile->tree = p;
|
||||
} else {
|
||||
*((long long *) (treefile->map + ssp)) = p;
|
||||
*((long long *) (treefile->map.c_str() + ssp)) = p;
|
||||
}
|
||||
return off;
|
||||
}
|
||||
|
||||
+123
-124
@@ -9,9 +9,11 @@
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <limits.h>
|
||||
#include <zlib.h>
|
||||
#include "protozero/varint.hpp"
|
||||
#include "geometry.hpp"
|
||||
#include "mbtiles.hpp"
|
||||
#include "mvt.hpp"
|
||||
#include "tile.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "options.hpp"
|
||||
@@ -27,12 +29,15 @@
|
||||
#define SHIFT_RIGHT(a) ((long long) std::round((double)(a) / (1LL << geometry_scale)))
|
||||
#define SHIFT_LEFT(a) ((((a) + (COORD_OFFSET >> geometry_scale)) << geometry_scale) - COORD_OFFSET)
|
||||
|
||||
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, const char *fname) {
|
||||
// write to file
|
||||
|
||||
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, std::atomic<long long> *fpos, const char *fname) {
|
||||
size_t w = fwrite(ptr, size, nitems, stream);
|
||||
if (w != nitems) {
|
||||
fprintf(stderr, "%s: Write to temporary file failed: %s\n", fname, strerror(errno));
|
||||
exit(EXIT_WRITE);
|
||||
}
|
||||
*fpos += size * nitems;
|
||||
return w;
|
||||
}
|
||||
|
||||
@@ -69,15 +74,54 @@ void serialize_ulong_long(FILE *out, unsigned long long zigzag, std::atomic<long
|
||||
}
|
||||
|
||||
void serialize_byte(FILE *out, signed char n, std::atomic<long long> *fpos, const char *fname) {
|
||||
fwrite_check(&n, sizeof(signed char), 1, out, fname);
|
||||
*fpos += sizeof(signed char);
|
||||
fwrite_check(&n, sizeof(signed char), 1, out, fpos, fname);
|
||||
}
|
||||
|
||||
void serialize_uint(FILE *out, unsigned n, std::atomic<long long> *fpos, const char *fname) {
|
||||
fwrite_check(&n, sizeof(unsigned), 1, out, fname);
|
||||
*fpos += sizeof(unsigned);
|
||||
serialize_ulong_long(out, n, fpos, fname);
|
||||
}
|
||||
|
||||
// write to memory
|
||||
|
||||
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, std::string &stream) {
|
||||
stream += std::string((char *) ptr, size * nitems);
|
||||
return nitems;
|
||||
}
|
||||
|
||||
void serialize_ulong_long(std::string &out, unsigned long long zigzag) {
|
||||
while (1) {
|
||||
unsigned char b = zigzag & 0x7F;
|
||||
if ((zigzag >> 7) != 0) {
|
||||
b |= 0x80;
|
||||
out += b;
|
||||
zigzag >>= 7;
|
||||
} else {
|
||||
out += b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void serialize_long_long(std::string &out, long long n) {
|
||||
unsigned long long zigzag = protozero::encode_zigzag64(n);
|
||||
|
||||
serialize_ulong_long(out, zigzag);
|
||||
}
|
||||
|
||||
void serialize_int(std::string &out, int n) {
|
||||
serialize_long_long(out, n);
|
||||
}
|
||||
|
||||
void serialize_byte(std::string &out, signed char n) {
|
||||
out += n;
|
||||
}
|
||||
|
||||
void serialize_uint(std::string &out, unsigned n) {
|
||||
serialize_ulong_long(out, n);
|
||||
}
|
||||
|
||||
// read from memory
|
||||
|
||||
void deserialize_int(char **f, int *n) {
|
||||
long long ll;
|
||||
deserialize_long_long(f, &ll);
|
||||
@@ -109,8 +153,9 @@ void deserialize_ulong_long(char **f, unsigned long long *zigzag) {
|
||||
}
|
||||
|
||||
void deserialize_uint(char **f, unsigned *n) {
|
||||
memcpy(n, *f, sizeof(unsigned));
|
||||
*f += sizeof(unsigned);
|
||||
unsigned long long v;
|
||||
deserialize_ulong_long(f, &v);
|
||||
*n = v;
|
||||
}
|
||||
|
||||
void deserialize_byte(char **f, signed char *n) {
|
||||
@@ -118,6 +163,8 @@ void deserialize_byte(char **f, signed char *n) {
|
||||
*f += sizeof(signed char);
|
||||
}
|
||||
|
||||
// read from file
|
||||
|
||||
int deserialize_long_long_io(FILE *f, long long *n, std::atomic<long long> *geompos) {
|
||||
unsigned long long zigzag = 0;
|
||||
int ret = deserialize_ulong_long_io(f, &zigzag, geompos);
|
||||
@@ -157,10 +204,9 @@ int deserialize_int_io(FILE *f, int *n, std::atomic<long long> *geompos) {
|
||||
}
|
||||
|
||||
int deserialize_uint_io(FILE *f, unsigned *n, std::atomic<long long> *geompos) {
|
||||
if (fread(n, sizeof(unsigned), 1, f) != 1) {
|
||||
return 0;
|
||||
}
|
||||
*geompos += sizeof(unsigned);
|
||||
unsigned long long v;
|
||||
deserialize_ulong_long_io(f, &v, geompos);
|
||||
*n = v;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -174,23 +220,26 @@ int deserialize_byte_io(FILE *f, signed char *n, std::atomic<long long> *geompos
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void write_geometry(drawvec const &dv, std::atomic<long long> *fpos, FILE *out, const char *fname, long long wx, long long wy) {
|
||||
static void write_geometry(drawvec const &dv, std::string &out, long long wx, long long wy) {
|
||||
for (size_t i = 0; i < dv.size(); i++) {
|
||||
if (dv[i].op == VT_MOVETO || dv[i].op == VT_LINETO) {
|
||||
serialize_byte(out, dv[i].op, fpos, fname);
|
||||
serialize_long_long(out, dv[i].x - wx, fpos, fname);
|
||||
serialize_long_long(out, dv[i].y - wy, fpos, fname);
|
||||
serialize_byte(out, dv[i].op);
|
||||
serialize_long_long(out, dv[i].x - wx);
|
||||
serialize_long_long(out, dv[i].y - wy);
|
||||
wx = dv[i].x;
|
||||
wy = dv[i].y;
|
||||
} else {
|
||||
serialize_byte(out, dv[i].op, fpos, fname);
|
||||
serialize_byte(out, dv[i].op);
|
||||
}
|
||||
}
|
||||
serialize_byte(out, VT_END);
|
||||
}
|
||||
|
||||
// called from generating the next zoom level
|
||||
void serialize_feature(FILE *geomfile, serial_feature *sf, std::atomic<long long> *geompos, const char *fname, long long wx, long long wy, bool include_minzoom) {
|
||||
serialize_byte(geomfile, sf->t, geompos, fname);
|
||||
std::string serialize_feature(serial_feature *sf, long long wx, long long wy) {
|
||||
std::string s;
|
||||
|
||||
serialize_byte(s, sf->t);
|
||||
|
||||
#define FLAG_LAYER 7
|
||||
|
||||
@@ -212,63 +261,56 @@ void serialize_feature(FILE *geomfile, serial_feature *sf, std::atomic<long long
|
||||
layer |= sf->has_tippecanoe_minzoom << FLAG_MINZOOM;
|
||||
layer |= sf->has_tippecanoe_maxzoom << FLAG_MAXZOOM;
|
||||
|
||||
serialize_long_long(geomfile, layer, geompos, fname);
|
||||
serialize_long_long(s, layer);
|
||||
if (sf->seq != 0) {
|
||||
serialize_long_long(geomfile, sf->seq, geompos, fname);
|
||||
serialize_long_long(s, sf->seq);
|
||||
}
|
||||
if (sf->has_tippecanoe_minzoom) {
|
||||
serialize_int(geomfile, sf->tippecanoe_minzoom, geompos, fname);
|
||||
serialize_int(s, sf->tippecanoe_minzoom);
|
||||
}
|
||||
if (sf->has_tippecanoe_maxzoom) {
|
||||
serialize_int(geomfile, sf->tippecanoe_maxzoom, geompos, fname);
|
||||
serialize_int(s, sf->tippecanoe_maxzoom);
|
||||
}
|
||||
if (sf->has_id) {
|
||||
serialize_ulong_long(geomfile, sf->id, geompos, fname);
|
||||
serialize_ulong_long(s, sf->id);
|
||||
}
|
||||
|
||||
serialize_int(geomfile, sf->segment, geompos, fname);
|
||||
serialize_int(s, sf->segment);
|
||||
|
||||
write_geometry(sf->geometry, s, wx, wy);
|
||||
|
||||
write_geometry(sf->geometry, geompos, geomfile, fname, wx, wy);
|
||||
serialize_byte(geomfile, VT_END, geompos, fname);
|
||||
if (sf->index != 0) {
|
||||
serialize_ulong_long(geomfile, sf->index, geompos, fname);
|
||||
serialize_ulong_long(s, sf->index);
|
||||
}
|
||||
if (sf->label_point != 0) {
|
||||
serialize_ulong_long(geomfile, sf->label_point, geompos, fname);
|
||||
serialize_ulong_long(s, sf->label_point);
|
||||
}
|
||||
if (sf->extent != 0) {
|
||||
serialize_long_long(geomfile, sf->extent, geompos, fname);
|
||||
serialize_long_long(s, sf->extent);
|
||||
}
|
||||
|
||||
serialize_long_long(geomfile, sf->metapos, geompos, fname);
|
||||
serialize_long_long(s, sf->keys.size());
|
||||
|
||||
if (sf->metapos < 0) {
|
||||
serialize_long_long(geomfile, sf->keys.size(), geompos, fname);
|
||||
|
||||
for (size_t i = 0; i < sf->keys.size(); i++) {
|
||||
serialize_long_long(geomfile, sf->keys[i], geompos, fname);
|
||||
serialize_long_long(geomfile, sf->values[i], geompos, fname);
|
||||
}
|
||||
for (size_t i = 0; i < sf->keys.size(); i++) {
|
||||
serialize_long_long(s, sf->keys[i]);
|
||||
serialize_long_long(s, sf->values[i]);
|
||||
}
|
||||
|
||||
if (include_minzoom) {
|
||||
serialize_byte(geomfile, sf->feature_minzoom, geompos, fname);
|
||||
}
|
||||
// MAGIC: This knows that the feature minzoom is the last byte of the feature,
|
||||
serialize_byte(s, sf->feature_minzoom);
|
||||
return s;
|
||||
}
|
||||
|
||||
serial_feature deserialize_feature(FILE *geoms, std::atomic<long long> *geompos_in, char *metabase, long long *meta_off, unsigned z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y) {
|
||||
serial_feature deserialize_feature(std::string &geoms, unsigned z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y) {
|
||||
serial_feature sf;
|
||||
char *cp = (char *) geoms.c_str();
|
||||
|
||||
deserialize_byte_io(geoms, &sf.t, geompos_in);
|
||||
if (sf.t < 0) {
|
||||
return sf;
|
||||
}
|
||||
|
||||
deserialize_long_long_io(geoms, &sf.layer, geompos_in);
|
||||
deserialize_byte(&cp, &sf.t);
|
||||
deserialize_long_long(&cp, &sf.layer);
|
||||
|
||||
sf.seq = 0;
|
||||
if (sf.layer & (1 << FLAG_SEQ)) {
|
||||
deserialize_long_long_io(geoms, &sf.seq, geompos_in);
|
||||
deserialize_long_long(&cp, &sf.seq);
|
||||
}
|
||||
|
||||
sf.tippecanoe_minzoom = -1;
|
||||
@@ -276,64 +318,54 @@ serial_feature deserialize_feature(FILE *geoms, std::atomic<long long> *geompos_
|
||||
sf.id = 0;
|
||||
sf.has_id = false;
|
||||
if (sf.layer & (1 << FLAG_MINZOOM)) {
|
||||
deserialize_int_io(geoms, &sf.tippecanoe_minzoom, geompos_in);
|
||||
deserialize_int(&cp, &sf.tippecanoe_minzoom);
|
||||
}
|
||||
if (sf.layer & (1 << FLAG_MAXZOOM)) {
|
||||
deserialize_int_io(geoms, &sf.tippecanoe_maxzoom, geompos_in);
|
||||
deserialize_int(&cp, &sf.tippecanoe_maxzoom);
|
||||
}
|
||||
if (sf.layer & (1 << FLAG_ID)) {
|
||||
sf.has_id = true;
|
||||
deserialize_ulong_long_io(geoms, &sf.id, geompos_in);
|
||||
deserialize_ulong_long(&cp, &sf.id);
|
||||
}
|
||||
|
||||
deserialize_int_io(geoms, &sf.segment, geompos_in);
|
||||
deserialize_int(&cp, &sf.segment);
|
||||
|
||||
sf.index = 0;
|
||||
sf.label_point = 0;
|
||||
sf.extent = 0;
|
||||
|
||||
sf.geometry = decode_geometry(geoms, geompos_in, z, tx, ty, sf.bbox, initial_x[sf.segment], initial_y[sf.segment]);
|
||||
sf.geometry = decode_geometry(&cp, z, tx, ty, sf.bbox, initial_x[sf.segment], initial_y[sf.segment]);
|
||||
|
||||
if (sf.layer & (1 << FLAG_INDEX)) {
|
||||
deserialize_ulong_long_io(geoms, &sf.index, geompos_in);
|
||||
deserialize_ulong_long(&cp, &sf.index);
|
||||
}
|
||||
if (sf.layer & (1 << FLAG_LABEL_POINT)) {
|
||||
deserialize_ulong_long_io(geoms, &sf.label_point, geompos_in);
|
||||
deserialize_ulong_long(&cp, &sf.label_point);
|
||||
}
|
||||
if (sf.layer & (1 << FLAG_EXTENT)) {
|
||||
deserialize_long_long_io(geoms, &sf.extent, geompos_in);
|
||||
deserialize_long_long(&cp, &sf.extent);
|
||||
}
|
||||
|
||||
sf.layer >>= FLAG_LAYER;
|
||||
|
||||
sf.metapos = 0;
|
||||
deserialize_long_long_io(geoms, &sf.metapos, geompos_in);
|
||||
long long count;
|
||||
deserialize_long_long(&cp, &count);
|
||||
|
||||
if (sf.metapos >= 0) {
|
||||
char *meta = metabase + sf.metapos + meta_off[sf.segment];
|
||||
long long count;
|
||||
deserialize_long_long(&meta, &count);
|
||||
|
||||
for (long long i = 0; i < count; i++) {
|
||||
long long k, v;
|
||||
deserialize_long_long(&meta, &k);
|
||||
deserialize_long_long(&meta, &v);
|
||||
sf.keys.push_back(k);
|
||||
sf.values.push_back(v);
|
||||
}
|
||||
} else {
|
||||
long long count;
|
||||
deserialize_long_long_io(geoms, &count, geompos_in);
|
||||
|
||||
for (long long i = 0; i < count; i++) {
|
||||
long long k, v;
|
||||
deserialize_long_long_io(geoms, &k, geompos_in);
|
||||
deserialize_long_long_io(geoms, &v, geompos_in);
|
||||
sf.keys.push_back(k);
|
||||
sf.values.push_back(v);
|
||||
}
|
||||
for (long long i = 0; i < count; i++) {
|
||||
long long k, v;
|
||||
deserialize_long_long(&cp, &k);
|
||||
deserialize_long_long(&cp, &v);
|
||||
sf.keys.push_back(k);
|
||||
sf.values.push_back(v);
|
||||
}
|
||||
|
||||
deserialize_byte_io(geoms, &sf.feature_minzoom, geompos_in);
|
||||
// MAGIC: This knows that the feature minzoom is the last byte of the feature.
|
||||
deserialize_byte(&cp, &sf.feature_minzoom);
|
||||
|
||||
if (cp != geoms.c_str() + geoms.size()) {
|
||||
fprintf(stderr, "wrong length decoding feature: used %zd, len is %zu\n", cp - geoms.c_str(), geoms.size());
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
return sf;
|
||||
}
|
||||
@@ -512,32 +544,6 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
locs.clear();
|
||||
}
|
||||
|
||||
bool inline_meta = true;
|
||||
// Don't inline metadata for features that will span several tiles at maxzoom
|
||||
if (scaled_geometry.size() > 0 && (sf.bbox[2] < sf.bbox[0] || sf.bbox[3] < sf.bbox[1])) {
|
||||
fprintf(stderr, "Internal error: impossible feature bounding box %llx,%llx,%llx,%llx\n", sf.bbox[0], sf.bbox[1], sf.bbox[2], sf.bbox[3]);
|
||||
}
|
||||
if (sf.bbox[0] == LLONG_MAX) {
|
||||
// No bounding box (empty geometry)
|
||||
// Shouldn't happen, but avoid arithmetic overflow below
|
||||
} else if (sf.bbox[2] - sf.bbox[0] > (2LL << (32 - sst->maxzoom)) || sf.bbox[3] - sf.bbox[1] > (2LL << (32 - sst->maxzoom))) {
|
||||
inline_meta = false;
|
||||
|
||||
if (prevent[P_CLIPPING]) {
|
||||
static std::atomic<long long> warned(0);
|
||||
long long extent = ((sf.bbox[2] - sf.bbox[0]) / ((1LL << (32 - sst->maxzoom)) + 1)) * ((sf.bbox[3] - sf.bbox[1]) / ((1LL << (32 - sst->maxzoom)) + 1));
|
||||
if (extent > warned) {
|
||||
fprintf(stderr, "Warning: %s:%d: Large unclipped (-pc) feature may be duplicated across %lld tiles\n", sst->fname, sst->line, extent);
|
||||
warned = extent;
|
||||
|
||||
if (extent > 10000) {
|
||||
fprintf(stderr, "Exiting because this can't be right.\n");
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double extent = 0;
|
||||
if (additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED] || order_by_size || sst->want_dist) {
|
||||
if (sf.t == VT_POLYGON) {
|
||||
@@ -725,24 +731,17 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
}
|
||||
}
|
||||
|
||||
if (inline_meta) {
|
||||
sf.metapos = -1;
|
||||
for (size_t i = 0; i < sf.full_keys.size(); i++) {
|
||||
sf.keys.push_back(addpool(r->poolfile, r->treefile, sf.full_keys[i].c_str(), mvt_string));
|
||||
sf.values.push_back(addpool(r->poolfile, r->treefile, sf.full_values[i].s.c_str(), sf.full_values[i].type));
|
||||
}
|
||||
} else {
|
||||
sf.metapos = r->metapos;
|
||||
serialize_long_long(r->metafile, sf.full_keys.size(), &r->metapos, sst->fname);
|
||||
for (size_t i = 0; i < sf.full_keys.size(); i++) {
|
||||
serialize_long_long(r->metafile, addpool(r->poolfile, r->treefile, sf.full_keys[i].c_str(), mvt_string), &r->metapos, sst->fname);
|
||||
serialize_long_long(r->metafile, addpool(r->poolfile, r->treefile, sf.full_values[i].s.c_str(), sf.full_values[i].type), &r->metapos, sst->fname);
|
||||
}
|
||||
for (size_t i = 0; i < sf.full_keys.size(); i++) {
|
||||
sf.keys.push_back(addpool(r->poolfile, r->treefile, sf.full_keys[i].c_str(), mvt_string));
|
||||
sf.values.push_back(addpool(r->poolfile, r->treefile, sf.full_values[i].s.c_str(), sf.full_values[i].type));
|
||||
}
|
||||
|
||||
long long geomstart = r->geompos;
|
||||
sf.geometry = scaled_geometry;
|
||||
serialize_feature(r->geomfile, &sf, &r->geompos, sst->fname, SHIFT_RIGHT(*(sst->initial_x)), SHIFT_RIGHT(*(sst->initial_y)), false);
|
||||
|
||||
std::string feature = serialize_feature(&sf, SHIFT_RIGHT(*(sst->initial_x)), SHIFT_RIGHT(*(sst->initial_y)));
|
||||
serialize_long_long(r->geomfile, feature.size(), &r->geompos, sst->fname);
|
||||
fwrite_check(feature.c_str(), sizeof(char), feature.size(), r->geomfile, &r->geompos, sst->fname);
|
||||
|
||||
struct index index;
|
||||
index.start = geomstart;
|
||||
@@ -752,8 +751,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
index.t = sf.t;
|
||||
index.ix = bbox_index;
|
||||
|
||||
fwrite_check(&index, sizeof(struct index), 1, r->indexfile, sst->fname);
|
||||
r->indexpos += sizeof(struct index);
|
||||
fwrite_check(&index, sizeof(struct index), 1, r->indexfile, &r->indexpos, sst->fname);
|
||||
|
||||
for (size_t i = 0; i < 2; i++) {
|
||||
if (sf.bbox[i] < r->file_bbox[i]) {
|
||||
@@ -770,6 +768,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
checkdisk(sst->readers);
|
||||
if (!quiet && !quiet_progress && progress_time()) {
|
||||
fprintf(stderr, "Read %.2f million features\r", *sst->progress_seq / 1000000.0);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
(*(sst->progress_seq))++;
|
||||
|
||||
+11
-18
@@ -11,14 +11,19 @@
|
||||
#include "mbtiles.hpp"
|
||||
#include "jsonpull/jsonpull.h"
|
||||
|
||||
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, const char *fname);
|
||||
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, std::atomic<long long> *fpos, const char *fname);
|
||||
|
||||
void serialize_int(FILE *out, int n, std::atomic<long long> *fpos, const char *fname);
|
||||
void serialize_long_long(FILE *out, long long n, std::atomic<long long> *fpos, const char *fname);
|
||||
void serialize_ulong_long(FILE *out, unsigned long long n, std::atomic<long long> *fpos, const char *fname);
|
||||
void serialize_byte(FILE *out, signed char n, std::atomic<long long> *fpos, const char *fname);
|
||||
void serialize_uint(FILE *out, unsigned n, std::atomic<long long> *fpos, const char *fname);
|
||||
void serialize_string(FILE *out, const char *s, std::atomic<long long> *fpos, const char *fname);
|
||||
|
||||
void serialize_int(std::string &out, int n);
|
||||
void serialize_long_long(std::string &out, long long n);
|
||||
void serialize_ulong_long(std::string &out, unsigned long long n);
|
||||
void serialize_byte(std::string &out, signed char n);
|
||||
void serialize_uint(std::string &out, unsigned n);
|
||||
|
||||
void deserialize_int(char **f, int *n);
|
||||
void deserialize_long_long(char **f, long long *n);
|
||||
@@ -61,8 +66,6 @@ struct serial_feature {
|
||||
|
||||
std::vector<long long> keys{};
|
||||
std::vector<long long> values{};
|
||||
// If >= 0, metadata is external
|
||||
long long metapos = 0;
|
||||
|
||||
// XXX This isn't serialized. Should it be here?
|
||||
long long bbox[4] = {0, 0, 0, 0};
|
||||
@@ -72,54 +75,45 @@ struct serial_feature {
|
||||
bool dropped = false;
|
||||
};
|
||||
|
||||
void serialize_feature(FILE *geomfile, serial_feature *sf, std::atomic<long long> *geompos, const char *fname, long long wx, long long wy, bool include_minzoom);
|
||||
serial_feature deserialize_feature(FILE *geoms, std::atomic<long long> *geompos_in, char *metabase, long long *meta_off, unsigned z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y);
|
||||
std::string serialize_feature(serial_feature *sf, long long wx, long long wy);
|
||||
serial_feature deserialize_feature(std::string &geoms, unsigned z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y);
|
||||
|
||||
struct reader {
|
||||
int metafd = -1;
|
||||
int poolfd = -1;
|
||||
int treefd = -1;
|
||||
int geomfd = -1;
|
||||
int indexfd = -1;
|
||||
|
||||
FILE *metafile = NULL;
|
||||
struct memfile *poolfile = NULL;
|
||||
struct memfile *treefile = NULL;
|
||||
FILE *geomfile = NULL;
|
||||
FILE *indexfile = NULL;
|
||||
|
||||
std::atomic<long long> metapos;
|
||||
std::atomic<long long> geompos;
|
||||
std::atomic<long long> indexpos;
|
||||
|
||||
long long file_bbox[4] = {0, 0, 0, 0};
|
||||
|
||||
struct stat geomst {};
|
||||
struct stat metast {};
|
||||
|
||||
char *geom_map = NULL;
|
||||
|
||||
reader()
|
||||
: metapos(0), geompos(0), indexpos(0) {
|
||||
: geompos(0), indexpos(0) {
|
||||
}
|
||||
|
||||
reader(reader const &r) {
|
||||
metafd = r.metafd;
|
||||
poolfd = r.poolfd;
|
||||
treefd = r.treefd;
|
||||
geomfd = r.geomfd;
|
||||
indexfd = r.indexfd;
|
||||
|
||||
metafile = r.metafile;
|
||||
poolfile = r.poolfile;
|
||||
treefile = r.treefile;
|
||||
geomfile = r.geomfile;
|
||||
indexfile = r.indexfile;
|
||||
|
||||
long long p = r.metapos;
|
||||
metapos = p;
|
||||
|
||||
p = r.geompos;
|
||||
long long p = r.geompos;
|
||||
geompos = p;
|
||||
|
||||
p = r.indexpos;
|
||||
@@ -128,7 +122,6 @@ struct reader {
|
||||
memcpy(file_bbox, r.file_bbox, sizeof(file_bbox));
|
||||
|
||||
geomst = r.geomst;
|
||||
metast = r.metast;
|
||||
|
||||
geom_map = r.geom_map;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
-20
@@ -1,6 +1,6 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"bounds": "-124.213807,29.689480,-70.645734,49.005639",
|
||||
"center": "-95.625000,44.951199,5",
|
||||
"center": "-118.125000,44.951199,5",
|
||||
"description": "tests/ne_110m_admin_1_states_provinces_lines/out/-z5_-M500_--drop-smallest-as-needed.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/ne_110m_admin_1_states_provinces_lines/out/-z5_-M500_--drop-smallest-as-needed.json.check.mbtiles -z5 -M500 --drop-smallest-as-needed tests/ne_110m_admin_1_states_provinces_lines/in.json",
|
||||
@@ -8,7 +8,7 @@
|
||||
"maxzoom": "5",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_admin_1_states_provinces_lines/out/-z5_-M500_--drop-smallest-as-needed.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_as_needed\":92,\"tile_size_desired\":1377},{\"dropped_as_needed\":96,\"tile_size_desired\":1738},{\"dropped_as_needed\":115,\"tile_size_desired\":1303},{\"dropped_as_needed\":126,\"tile_size_desired\":1154},{\"dropped_as_needed\":103,\"tile_size_desired\":1228},{\"dropped_as_needed\":101,\"tile_size_desired\":1077}]",
|
||||
"strategies": "[{\"dropped_as_needed\":92,\"tile_size_desired\":1377},{\"dropped_as_needed\":96,\"tile_size_desired\":1738},{\"dropped_as_needed\":115,\"tile_size_desired\":1303},{\"dropped_as_needed\":127,\"tile_size_desired\":1154},{\"dropped_as_needed\":105,\"tile_size_desired\":1228},{\"dropped_as_needed\":106,\"tile_size_desired\":1077}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
@@ -124,8 +124,6 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -120.003662, 41.640078 ], [ -120.003662, 40.979898 ], [ -120.003662, 38.993572 ], [ -118.114014, 37.640335 ], [ -114.642334, 35.047987 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -111.049805, 41.640078 ], [ -111.049805, 41.029643 ], [ -109.050293, 41.004775 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -114.027100, 36.993778 ], [ -114.038086, 40.979898 ], [ -114.038086, 41.640078 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -102.996826, 36.993778 ], [ -109.039307, 37.002553 ] ] } }
|
||||
@@ -187,8 +185,6 @@
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -119.998169, 41.310824 ], [ -119.998169, 40.979898 ], [ -119.998169, 38.993572 ], [ -118.114014, 37.644685 ], [ -114.642334, 35.052484 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -114.027100, 36.993778 ], [ -114.032593, 40.979898 ], [ -114.032593, 41.310824 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -114.027100, 36.993778 ], [ -114.021606, 36.186659 ], [ -114.065552, 36.155618 ], [ -114.131470, 36.004673 ], [ -114.268799, 36.044658 ], [ -114.461060, 36.115690 ], [ -114.669800, 36.115690 ], [ -114.735718, 35.991341 ], [ -114.647827, 35.853440 ], [ -114.647827, 35.639441 ], [ -114.631348, 35.442771 ], [ -114.581909, 35.250105 ], [ -114.642334, 35.052484 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -236,8 +232,6 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -111.082764, 44.504341 ], [ -111.192627, 44.559163 ], [ -111.291504, 44.699898 ], [ -111.401367, 44.727223 ], [ -111.538696, 44.527843 ], [ -111.769409, 44.496505 ], [ -112.335205, 44.559163 ], [ -112.362671, 44.461231 ], [ -112.500000, 44.476911 ], [ -112.692261, 44.496505 ], [ -112.873535, 44.359206 ], [ -112.939453, 44.457310 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -111.049805, 42.000325 ], [ -112.500000, 41.996243 ], [ -112.939453, 41.996243 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -111.082764, 44.504341 ], [ -111.066284, 44.539590 ], [ -111.071777, 45.050240 ], [ -109.099731, 45.054121 ], [ -107.545166, 45.046359 ], [ -105.743408, 45.050240 ], [ -104.078979, 45.038597 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.024048, 45.954969 ], [ -100.063477, 45.966425 ], [ -98.442993, 45.962606 ], [ -96.536865, 46.016039 ] ] } }
|
||||
@@ -254,14 +248,14 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -90.439453, 36.478724 ], [ -90.115356, 36.461054 ], [ -90.032959, 36.337253 ], [ -90.252686, 36.120128 ], [ -90.318604, 36.022447 ], [ -90.000000, 36.022447 ], [ -89.659424, 36.022447 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -89.659424, 36.022447 ], [ -89.670410, 35.937988 ], [ -89.774780, 35.799994 ], [ -89.950562, 35.701917 ], [ -89.989014, 35.536696 ], [ -90.000000, 35.527756 ], [ -90.148315, 35.402484 ], [ -90.137329, 35.110922 ], [ -90.252686, 35.021000 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -90.439453, 31.015279 ], [ -90.000000, 31.015279 ], [ -89.758301, 31.010571 ], [ -89.785767, 30.845647 ], [ -89.851685, 30.680440 ], [ -89.791260, 30.557531 ], [ -89.659424, 30.439202 ], [ -89.604492, 30.173625 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -83.671875, 36.597889 ], [ -84.347534, 36.567012 ], [ -85.231934, 36.606709 ], [ -85.517578, 36.597889 ], [ -86.088867, 36.624345 ], [ -87.214966, 36.637570 ], [ -87.841187, 36.611118 ], [ -87.874146, 36.655200 ], [ -88.071899, 36.655200 ], [ -88.066406, 36.496390 ], [ -89.494629, 36.505221 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -77.722778, 39.321550 ], [ -77.832642, 39.134321 ], [ -78.343506, 39.406489 ], [ -78.420410, 39.138582 ], [ -78.546753, 39.040520 ], [ -78.744507, 38.908133 ], [ -78.892822, 38.779781 ], [ -78.964233, 38.822591 ], [ -79.172974, 38.552461 ], [ -79.222412, 38.462192 ], [ -79.365234, 38.423470 ], [ -79.513550, 38.496594 ], [ -79.645386, 38.573938 ], [ -79.744263, 38.354580 ], [ -79.914551, 38.177751 ], [ -79.963989, 38.030786 ], [ -80.156250, 37.900865 ], [ -80.293579, 37.727280 ], [ -80.277100, 37.609880 ], [ -80.299072, 37.518440 ], [ -80.452881, 37.439974 ], [ -80.595703, 37.453057 ], [ -80.716553, 37.383253 ], [ -80.831909, 37.418163 ], [ -80.853882, 37.326489 ], [ -81.227417, 37.243448 ], [ -81.348267, 37.313383 ], [ -81.661377, 37.195331 ], [ -81.815186, 37.274053 ], [ -81.925049, 37.365791 ], [ -81.968994, 37.535866 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -83.073120, 34.976002 ], [ -82.435913, 35.178298 ], [ -81.513062, 35.169318 ], [ -81.046143, 35.124402 ], [ -81.035156, 35.034494 ], [ -80.936279, 35.101934 ], [ -80.776978, 34.930979 ], [ -80.782471, 34.818313 ], [ -79.672852, 34.804783 ], [ -78.552246, 33.861293 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -81.677856, 36.584658 ], [ -79.991455, 36.540536 ], [ -77.997437, 36.536123 ], [ -75.866089, 36.549362 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -88.165283, 34.998504 ], [ -88.093872, 34.804783 ], [ -88.269653, 33.509339 ], [ -88.445435, 31.910205 ], [ -88.417969, 30.382353 ] ] } }
|
||||
@@ -289,8 +283,6 @@
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -119.998169, 41.145570 ], [ -119.998169, 40.979898 ], [ -120.000916, 38.995707 ], [ -118.114014, 37.644685 ], [ -116.320496, 36.321764 ], [ -114.642334, 35.052484 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -114.029846, 36.993778 ], [ -114.035339, 40.979898 ], [ -114.035339, 41.145570 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -114.029846, 36.993778 ], [ -114.024353, 36.188875 ], [ -114.065552, 36.155618 ], [ -114.131470, 36.004673 ], [ -114.268799, 36.044658 ], [ -114.461060, 36.115690 ], [ -114.672546, 36.115690 ], [ -114.738464, 35.991341 ], [ -114.650574, 35.853440 ], [ -114.650574, 35.639441 ], [ -114.631348, 35.445009 ], [ -114.581909, 35.250105 ], [ -114.642334, 35.052484 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -348,8 +340,6 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -111.085510, 44.506300 ], [ -111.195374, 44.561120 ], [ -111.291504, 44.701850 ], [ -111.401367, 44.729174 ], [ -111.541443, 44.529801 ], [ -111.772156, 44.498464 ], [ -112.335205, 44.561120 ], [ -112.362671, 44.463191 ], [ -112.500000, 44.478871 ], [ -112.689514, 44.498464 ], [ -112.719727, 44.474951 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -111.049805, 42.002366 ], [ -112.500000, 41.998284 ], [ -112.719727, 41.996243 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -111.085510, 44.506300 ], [ -111.066284, 44.541548 ], [ -111.071777, 45.050240 ], [ -109.102478, 45.056061 ], [ -107.547913, 45.046359 ], [ -105.746155, 45.050240 ], [ -104.078979, 45.040537 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.026794, 45.956878 ], [ -101.250000, 45.962606 ], [ -101.030273, 45.964515 ] ] } }
|
||||
@@ -367,8 +357,6 @@
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 7, "y": 13 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -91.098633, 32.138409 ], [ -91.128845, 32.015063 ], [ -91.205750, 31.952162 ], [ -91.321106, 31.858897 ], [ -91.411743, 31.651043 ], [ -91.502380, 31.407568 ], [ -91.623230, 31.297328 ], [ -91.584778, 31.048228 ], [ -90.700378, 31.015279 ], [ -90.000000, 31.012925 ], [ -89.780273, 31.012925 ] ], [ [ -89.780273, 30.892797 ], [ -89.788513, 30.848005 ], [ -89.854431, 30.682802 ], [ -89.791260, 30.557531 ], [ -89.780273, 30.548070 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -94.010010, 32.138409 ], [ -93.999023, 31.952162 ], [ -93.999023, 31.942840 ], [ -93.834229, 31.830899 ], [ -93.694153, 31.442724 ], [ -93.578796, 31.215150 ], [ -93.490906, 31.078813 ], [ -93.587036, 30.713504 ], [ -93.650208, 30.604822 ], [ -93.738098, 30.365766 ], [ -93.663940, 30.299389 ], [ -93.666687, 30.099990 ], [ -93.817749, 29.969212 ], [ -93.919373, 29.821583 ], [ -93.836975, 29.690439 ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -412,8 +400,6 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -90.219727, 31.015279 ], [ -90.000000, 31.012925 ], [ -89.758301, 31.012925 ], [ -89.788513, 30.848005 ], [ -89.854431, 30.682802 ], [ -89.791260, 30.557531 ], [ -89.659424, 30.441570 ], [ -89.604492, 30.175999 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -85.003967, 30.991737 ], [ -85.053406, 31.109389 ], [ -85.116577, 31.236289 ], [ -85.064392, 31.576196 ], [ -85.119324, 31.765537 ], [ -85.086365, 31.952162 ], [ -85.064392, 32.082575 ], [ -85.012207, 32.138409 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -88.423462, 32.138409 ], [ -88.442688, 31.952162 ], [ -88.448181, 31.912536 ], [ -88.417969, 30.384723 ] ] } }
|
||||
] }
|
||||
] }
|
||||
@@ -424,8 +410,6 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ -90.219727, 36.467681 ], [ -90.112610, 36.461054 ], [ -90.030212, 36.337253 ], [ -90.219727, 36.155618 ] ], [ [ -90.219727, 36.022447 ], [ -90.000000, 36.022447 ], [ -89.662170, 36.022447 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -89.662170, 36.022447 ], [ -89.673157, 35.940212 ], [ -89.774780, 35.799994 ], [ -89.950562, 35.701917 ], [ -89.989014, 35.536696 ], [ -90.000000, 35.527756 ], [ -90.148315, 35.404722 ], [ -90.134583, 35.113169 ], [ -90.219727, 35.045738 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -83.674622, 36.600094 ], [ -84.350281, 36.567012 ], [ -85.231934, 36.608914 ], [ -85.520325, 36.597889 ], [ -86.091614, 36.626550 ], [ -87.217712, 36.639774 ], [ -87.841187, 36.611118 ], [ -87.874146, 36.657403 ], [ -88.071899, 36.655200 ], [ -88.069153, 36.496390 ], [ -89.497375, 36.505221 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -78.530273, 39.055451 ], [ -78.750000, 38.903858 ], [ -78.892822, 38.779781 ], [ -78.964233, 38.822591 ], [ -79.175720, 38.554609 ], [ -79.222412, 38.464342 ], [ -79.365234, 38.425622 ], [ -79.516296, 38.496594 ], [ -79.648132, 38.573938 ], [ -79.744263, 38.356734 ], [ -79.914551, 38.179910 ], [ -79.963989, 38.030786 ], [ -80.156250, 37.900865 ], [ -80.293579, 37.727280 ], [ -80.277100, 37.609880 ], [ -80.299072, 37.518440 ], [ -80.455627, 37.442155 ], [ -80.595703, 37.455238 ], [ -80.719299, 37.383253 ], [ -80.831909, 37.418163 ], [ -80.853882, 37.328673 ], [ -81.227417, 37.245635 ], [ -81.348267, 37.315568 ], [ -81.664124, 37.195331 ], [ -81.815186, 37.276238 ], [ -81.927795, 37.365791 ], [ -81.971741, 37.535866 ] ] } }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"maxzoom": "1",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-z1_-M10000_--drop-smallest-as-needed.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_by_rate\":145,\"dropped_as_needed\":74,\"tile_size_desired\":32932},{\"dropped_as_needed\":200,\"tile_size_desired\":44398}]",
|
||||
"strategies": "[{\"dropped_by_rate\":145,\"dropped_as_needed\":75,\"tile_size_desired\":32932},{\"dropped_as_needed\":204,\"tile_size_desired\":44398}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
@@ -16,8 +16,6 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NATSCALE": 300, "LABELRANK": 2, "FEATURECLA": "Populated place", "NAME": "Vancouver", "DIFFASCII": 0, "NAMEASCII": "Vancouver", "ADM0CAP": 0, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Canada", "SOV_A3": "CAN", "ADM0NAME": "Canada", "ADM0_A3": "CAN", "ADM1NAME": "British Columbia", "ISO_A2": "CA", "LATITUDE": 49.273417, "LONGITUDE": -123.121644, "CHANGED": 5, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 2313328, "POP_MIN": 603502, "POP_OTHER": 482002, "RANK_MAX": 12, "RANK_MIN": 11, "GEONAMEID": 6173331, "MEGANAME": "Vancouver", "LS_NAME": "Vancouver2", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 1590116, "MAX_POP20": 1588839, "MAX_POP50": 1590116, "MAX_POP300": 1590116, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 706, "MAX_AREAKM": 708, "MIN_AREAMI": 273, "MAX_AREAMI": 273, "MIN_PERKM": 398, "MAX_PERKM": 405, "MIN_PERMI": 248, "MAX_PERMI": 251, "MIN_BBXMIN": -123.283333, "MAX_BBXMIN": -123.283333, "MIN_BBXMAX": -122.708333, "MAX_BBXMAX": -122.708333, "MIN_BBYMIN": 49.1, "MAX_BBYMIN": 49.1, "MIN_BBYMAX": 49.383333, "MAX_BBYMAX": 49.383333, "MEAN_BBXC": -122.982768, "MEAN_BBYC": 49.228888, "COMPARE": 0, "GN_ASCII": "Vancouver", "FEATURE_CL": "P", "FEATURE_CO": "PPL", "ADMIN1_COD": 2, "GN_POP": 1837969, "ELEVATION": 0, "GTOPO30": 63, "TIMEZONE": "America/Vancouver", "GEONAMESNO": "Geonames ascii name + lat.d + long.d matching.", "UN_FID": 15, "UN_ADM0": "Canada", "UN_LAT": 49.27, "UN_LONG": -122.96, "POP1950": 556, "POP1955": 588, "POP1960": 620, "POP1965": 836, "POP1970": 1045, "POP1975": 1150, "POP1980": 1247, "POP1985": 1359, "POP1990": 1559, "POP1995": 1789, "POP2000": 1959, "POP2005": 2093, "POP2010": 2146, "POP2015": 2219, "POP2020": 2310, "POP2025": 2380, "POP2050": 2444 }, "geometry": { "type": "Point", "coordinates": [ -123.134766, 49.267805 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NATSCALE": 600, "LABELRANK": 1, "FEATURECLA": "Populated place", "NAME": "Los Angeles", "NAMEALT": "Los Angeles-Long Beach-Santa Ana", "DIFFASCII": 0, "NAMEASCII": "Los Angeles", "ADM0CAP": 0, "CAPALT": 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": 33.989978, "LONGITUDE": -118.179981, "CHANGED": 0, "NAMEDIFF": 0, "POP_MAX": 12500000, "POP_MIN": 3694820, "POP_OTHER": 142265, "RANK_MAX": 14, "RANK_MIN": 12, "GEONAMEID": 5368361, "MEGANAME": "Los Angeles-Long Beach-Santa Ana", "LS_NAME": "Los Angeles1", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 4976870, "MAX_POP20": 6558538, "MAX_POP50": 14868745, "MAX_POP300": 14870543, "MAX_POP310": 14903021, "MAX_NATSCA": 300, "MIN_AREAKM": 1338, "MAX_AREAKM": 5803, "MIN_AREAMI": 517, "MAX_AREAMI": 2241, "MIN_PERKM": 534, "MAX_PERKM": 2202, "MIN_PERMI": 332, "MAX_PERMI": 1369, "MIN_BBXMIN": -118.991667, "MAX_BBXMIN": -118.966667, "MIN_BBXMAX": -117.857183, "MAX_BBXMAX": -117.008333, "MIN_BBYMIN": 33.391667, "MAX_BBYMIN": 33.862631, "MIN_BBYMAX": 34.241667, "MAX_BBYMAX": 34.333333, "MEAN_BBXC": -118.107478, "MEAN_BBYC": 33.980609, "COMPARE": 0, "GN_ASCII": "Los Angeles", "FEATURE_CL": "P", "FEATURE_CO": "PPL", "ADMIN1_COD": 0, "GN_POP": 3694820, "ELEVATION": 89, "GTOPO30": 115, "TIMEZONE": "America/Los_Angeles", "GEONAMESNO": "GeoNames match with ascii name + lat + long whole numbers.", "UN_FID": 547, "UN_ADM0": "United States of America", "UN_LAT": 34, "UN_LONG": -118.25, "POP1950": 4046, "POP1955": 5154, "POP1960": 6530, "POP1965": 7408, "POP1970": 8378, "POP1975": 8926, "POP1980": 9512, "POP1985": 10181, "POP1990": 10883, "POP1995": 11339, "POP2000": 11814, "POP2005": 12307, "POP2010": 12500, "POP2015": 12773, "POP2020": 13160, "POP2025": 13461, "POP2050": 13672, "CITYALT": "Los Angeles" }, "geometry": { "type": "Point", "coordinates": [ -118.125000, 33.943360 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NATSCALE": 300, "LABELRANK": 2, "FEATURECLA": "Admin-1 capital", "NAME": "Monterrey", "DIFFASCII": 0, "NAMEASCII": "Monterrey", "ADM0CAP": 0, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Mexico", "SOV_A3": "MEX", "ADM0NAME": "Mexico", "ADM0_A3": "MEX", "ADM1NAME": "Nuevo León", "ISO_A2": "MX", "LATITUDE": 25.669995, "LONGITUDE": -100.329985, "CHANGED": 5, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 3712000, "POP_MIN": 1122874, "POP_OTHER": 3225636, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 3995465, "MEGANAME": "Monterrey", "LS_NAME": "Monterrey", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 3296184, "MAX_POP20": 3296184, "MAX_POP50": 3296184, "MAX_POP300": 3296184, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 594, "MAX_AREAKM": 594, "MIN_AREAMI": 229, "MAX_AREAMI": 229, "MIN_PERKM": 208, "MAX_PERKM": 208, "MIN_PERMI": 130, "MAX_PERMI": 130, "MIN_BBXMIN": -100.5, "MAX_BBXMIN": -100.5, "MIN_BBXMAX": -100.125, "MAX_BBXMAX": -100.125, "MIN_BBYMIN": 25.575, "MAX_BBYMIN": 25.575, "MIN_BBYMAX": 25.85, "MAX_BBYMAX": 25.85, "MEAN_BBXC": -100.290632, "MEAN_BBYC": 25.71613, "COMPARE": 0, "GN_ASCII": "Monterrey", "FEATURE_CL": "P", "FEATURE_CO": "PPL", "ADMIN1_COD": 19, "GN_POP": 1122874, "ELEVATION": 0, "GTOPO30": 563, "TIMEZONE": "America/Monterrey", "GEONAMESNO": "Geonames ascii name + lat.d + long.d matching.", "UN_FID": 359, "UN_ADM0": "Mexico", "UN_LAT": 25.67, "UN_LONG": -100.31, "POP1950": 356, "POP1955": 498, "POP1960": 698, "POP1965": 943, "POP1970": 1267, "POP1975": 1589, "POP1980": 1992, "POP1985": 2273, "POP1990": 2594, "POP1995": 2961, "POP2000": 3266, "POP2005": 3579, "POP2010": 3712, "POP2015": 3901, "POP2020": 4140, "POP2025": 4298, "POP2050": 4413 }, "geometry": { "type": "Point", "coordinates": [ -100.283203, 25.641526 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 2, "NATSCALE": 200, "LABELRANK": 6, "FEATURECLA": "Admin-0 capital", "NAME": "Havana", "NAMEALT": "La Habana", "DIFFASCII": 0, "NAMEASCII": "Havana", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Cuba", "SOV_A3": "CUB", "ADM0NAME": "Cuba", "ADM0_A3": "CUB", "ADM1NAME": "Ciudad de la Habana", "ISO_A2": "CU", "LATITUDE": 23.131959, "LONGITUDE": -82.364182, "CHANGED": 5, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 2174000, "POP_MIN": 1990917, "POP_OTHER": 1930305, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 3553478, "MEGANAME": "La Habana", "LS_NAME": "Havana", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 1990917, "MAX_POP20": 2051170, "MAX_POP50": 2051170, "MAX_POP300": 2051170, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 323, "MAX_AREAKM": 362, "MIN_AREAMI": 125, "MAX_AREAMI": 140, "MIN_PERKM": 240, "MAX_PERKM": 286, "MIN_PERMI": 149, "MAX_PERMI": 177, "MIN_BBXMIN": -82.533333, "MAX_BBXMIN": -82.533333, "MIN_BBXMAX": -82.208333, "MAX_BBXMAX": -82.208333, "MIN_BBYMIN": 22.916667, "MAX_BBYMIN": 22.975161, "MIN_BBYMAX": 23.183333, "MAX_BBYMAX": 23.183333, "MEAN_BBXC": -82.354344, "MEAN_BBYC": 23.076845, "COMPARE": 0, "GN_ASCII": "Havana", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 2, "GN_POP": 2163824, "ELEVATION": 0, "GTOPO30": 5, "TIMEZONE": "America/Havana", "GEONAMESNO": "GeoNames match general.", "UN_FID": 172, "UN_ADM0": "Cuba", "UN_LAT": 23.04, "UN_LONG": -82.41, "POP1950": 1116, "POP1955": 1289, "POP1960": 1436, "POP1965": 1598, "POP1970": 1779, "POP1975": 1848, "POP1980": 1913, "POP1985": 2005, "POP1990": 2108, "POP1995": 2183, "POP2000": 2187, "POP2005": 2189, "POP2010": 2174, "POP2015": 2159, "POP2020": 2151, "POP2025": 2150, "POP2050": 2150, "CITYALT": "Havana" }, "geometry": { "type": "Point", "coordinates": [ -82.353516, 23.079732 ] } }
|
||||
@@ -68,8 +66,6 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NATSCALE": 110, "LABELRANK": 0, "FEATURECLA": "Admin-0 capital", "NAME": "Nukualofa", "DIFFASCII": 0, "NAMEASCII": "Nukualofa", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 0, "SOV0NAME": "Tonga", "SOV_A3": "TON", "ADM0NAME": "Tonga", "ADM0_A3": "TON", "ISO_A2": "TO", "LATITUDE": -21.138512, "LONGITUDE": -175.220564, "CHANGED": 4, "NAMEDIFF": 0, "DIFFNOTE": "Location adjusted.", "POP_MAX": 42620, "POP_MIN": 23658, "POP_OTHER": 42620, "RANK_MAX": 7, "RANK_MIN": 7, "GEONAMEID": 4032402, "LS_NAME": "Nukualofa", "LS_MATCH": 1, "CHECKME": 5, "MAX_POP10": 42620, "MAX_POP20": 42620, "MAX_POP50": 42620, "MAX_POP300": 42620, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 15, "MAX_AREAKM": 15, "MIN_AREAMI": 6, "MAX_AREAMI": 6, "MIN_PERKM": 27, "MAX_PERKM": 27, "MIN_PERMI": 17, "MAX_PERMI": 17, "MIN_BBXMIN": -175.233333, "MAX_BBXMIN": -175.233333, "MIN_BBXMAX": -175.166667, "MAX_BBXMAX": -175.166667, "MIN_BBYMIN": -21.166667, "MAX_BBYMIN": -21.166667, "MIN_BBYMAX": -21.125, "MAX_BBYMAX": -21.125, "MEAN_BBXC": -175.206798, "MEAN_BBYC": -21.142325, "COMPARE": 0, "GN_ASCII": "Nuku`alofa", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 2, "GN_POP": 22400, "ELEVATION": 0, "GTOPO30": -9999, "TIMEZONE": "Pacific/Tongatapu", "GEONAMESNO": "GeoNames match general.", "UN_FID": 0, "UN_LAT": 0, "UN_LONG": 0, "POP1950": 0, "POP1955": 0, "POP1960": 0, "POP1965": 0, "POP1970": 0, "POP1975": 0, "POP1980": 0, "POP1985": 0, "POP1990": 0, "POP1995": 0, "POP2000": 0, "POP2005": 0, "POP2010": 0, "POP2015": 0, "POP2020": 0, "POP2025": 0, "POP2050": 0 }, "geometry": { "type": "Point", "coordinates": [ -175.209961, -21.125498 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NATSCALE": 110, "LABELRANK": 0, "FEATURECLA": "Admin-0 capital", "NAME": "Apia", "DIFFASCII": 0, "NAMEASCII": "Apia", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 0, "SOV0NAME": "Samoa", "SOV_A3": "WSM", "ADM0NAME": "Samoa", "ADM0_A3": "WSM", "ISO_A2": "WS", "LATITUDE": -13.841545, "LONGITUDE": -171.738642, "CHANGED": 4, "NAMEDIFF": 0, "DIFFNOTE": "Location adjusted.", "POP_MAX": 61916, "POP_MIN": 37708, "POP_OTHER": 0, "RANK_MAX": 8, "RANK_MIN": 7, "GEONAMEID": 3689793, "LS_NAME": "Apia", "LS_MATCH": 1, "CHECKME": 5, "MAX_POP10": 61916, "MAX_POP20": 61916, "MAX_POP50": 61916, "MAX_POP300": 61916, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 39, "MAX_AREAKM": 39, "MIN_AREAMI": 15, "MAX_AREAMI": 15, "MIN_PERKM": 51, "MAX_PERKM": 51, "MIN_PERMI": 32, "MAX_PERMI": 32, "MIN_BBXMIN": -171.825, "MAX_BBXMIN": -171.825, "MIN_BBXMAX": -171.716667, "MAX_BBXMAX": -171.716667, "MIN_BBYMIN": -13.866667, "MAX_BBYMIN": -13.866667, "MIN_BBYMAX": -13.8, "MAX_BBYMAX": -13.8, "MEAN_BBXC": -171.781117, "MEAN_BBYC": -13.837855, "COMPARE": 0, "GN_ASCII": "Apia", "FEATURE_CL": "P", "FEATURE_CO": "PPL", "ADMIN1_COD": 24, "GN_POP": 6940, "ELEVATION": 0, "GTOPO30": 1561, "TIMEZONE": "America/Bogota", "GEONAMESNO": "GeoNames match general.", "UN_FID": 0, "UN_LAT": 0, "UN_LONG": 0, "POP1950": 0, "POP1955": 0, "POP1960": 0, "POP1965": 0, "POP1970": 0, "POP1975": 0, "POP1980": 0, "POP1985": 0, "POP1990": 0, "POP1995": 0, "POP2000": 0, "POP2005": 0, "POP2010": 0, "POP2015": 0, "POP2020": 0, "POP2025": 0, "POP2050": 0 }, "geometry": { "type": "Point", "coordinates": [ -171.738281, -13.838080 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NATSCALE": 110, "LABELRANK": 7, "FEATURECLA": "Admin-0 capital", "NAME": "Quito", "DIFFASCII": 0, "NAMEASCII": "Quito", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Ecuador", "SOV_A3": "ECU", "ADM0NAME": "Ecuador", "ADM0_A3": "ECU", "ADM1NAME": "Pichincha", "ISO_A2": "EC", "LATITUDE": -0.214988, "LONGITUDE": -78.500051, "CHANGED": 0, "NAMEDIFF": 0, "POP_MAX": 1701000, "POP_MIN": 1399814, "POP_OTHER": 1435528, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 3652462, "MEGANAME": "Quito", "LS_NAME": "Quito", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 1472051, "MAX_POP20": 1892286, "MAX_POP50": 1892286, "MAX_POP300": 1892286, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 334, "MAX_AREAKM": 496, "MIN_AREAMI": 129, "MAX_AREAMI": 191, "MIN_PERKM": 233, "MAX_PERKM": 359, "MIN_PERMI": 145, "MAX_PERMI": 223, "MIN_BBXMIN": -78.591667, "MAX_BBXMIN": -78.591667, "MIN_BBXMAX": -78.291667, "MAX_BBXMAX": -78.291667, "MIN_BBYMIN": -0.391667, "MAX_BBYMIN": -0.30257, "MIN_BBYMAX": 0.025, "MAX_BBYMAX": 0.025, "MEAN_BBXC": -78.460061, "MEAN_BBYC": -0.198438, "COMPARE": 0, "GN_ASCII": "Quito", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 18, "GN_POP": 1399814, "ELEVATION": 0, "GTOPO30": 2764, "TIMEZONE": "America/Guayaquil", "GEONAMESNO": "GeoNames match general.", "UN_FID": 178, "UN_ADM0": "Ecuador", "UN_LAT": -0.22, "UN_LONG": -78.52, "POP1950": 206, "POP1955": 257, "POP1960": 319, "POP1965": 399, "POP1970": 501, "POP1975": 628, "POP1980": 780, "POP1985": 936, "POP1990": 1088, "POP1995": 1217, "POP2000": 1357, "POP2005": 1593, "POP2010": 1701, "POP2015": 1846, "POP2020": 2035, "POP2025": 2189, "POP2050": 2316 }, "geometry": { "type": "Point", "coordinates": [ -78.486328, -0.219726 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NATSCALE": 110, "LABELRANK": 3, "FEATURECLA": "Admin-0 capital alt", "NAME": "Valparaiso", "NAMEALT": "Valparaíso", "DIFFASCII": 0, "NAMEASCII": "Valparaiso", "ADM0CAP": 0, "CAPALT": 1, "CAPIN": "Legislative cap", "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Chile", "SOV_A3": "CHL", "ADM0NAME": "Chile", "ADM0_A3": "CHL", "ADM1NAME": "Valparaíso", "ISO_A2": "CL", "LATITUDE": -33.047764, "LONGITUDE": -71.621014, "CHANGED": 4, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 854000, "POP_MIN": 15938, "POP_OTHER": 130815, "RANK_MAX": 11, "RANK_MIN": 6, "GEONAMEID": 3445575, "MEGANAME": "Valparaíso", "LS_NAME": "Valparaiso2", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 144390, "MAX_POP20": 637860, "MAX_POP50": 637860, "MAX_POP300": 0, "MAX_POP310": 0, "MAX_NATSCA": 50, "MIN_AREAKM": 34, "MAX_AREAKM": 184, "MIN_AREAMI": 13, "MAX_AREAMI": 71, "MIN_PERKM": 33, "MAX_PERKM": 151, "MIN_PERMI": 21, "MAX_PERMI": 94, "MIN_BBXMIN": -71.658333, "MAX_BBXMIN": -71.658333, "MIN_BBXMAX": -71.57441, "MAX_BBXMAX": -71.325, "MIN_BBYMIN": -33.075, "MAX_BBYMIN": -33.075, "MIN_BBYMAX": -33.016667, "MAX_BBYMAX": -32.916667, "MEAN_BBXC": -71.541251, "MEAN_BBYC": -33.034648, "COMPARE": 0, "GN_ASCII": "Valparaiso", "FEATURE_CL": "P", "FEATURE_CO": "PPL", "ADMIN1_COD": 27, "GN_POP": 15938, "ELEVATION": 0, "GTOPO30": 405, "TIMEZONE": "America/Sao_Paulo", "GEONAMESNO": "GeoNames match general.", "UN_FID": 18, "UN_ADM0": "Chile", "UN_LAT": -33.02, "UN_LONG": -71.55, "POP1950": 328, "POP1955": 377, "POP1960": 433, "POP1965": 481, "POP1970": 532, "POP1975": 581, "POP1980": 635, "POP1985": 685, "POP1990": 733, "POP1995": 771, "POP2000": 803, "POP2005": 838, "POP2010": 854, "POP2015": 880, "POP2020": 922, "POP2025": 956, "POP2050": 982, "CITYALT": "Valparaiso" }, "geometry": { "type": "Point", "coordinates": [ -71.630859, -33.063924 ] } }
|
||||
@@ -90,8 +86,6 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NATSCALE": 300, "LABELRANK": 1, "FEATURECLA": "Populated place", "NAME": "San Francisco", "NAMEALT": "San Francisco-Oakland", "DIFFASCII": 0, "NAMEASCII": "San Francisco", "ADM0CAP": 0, "CAPALT": 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.740008, "LONGITUDE": -122.459978, "CHANGED": 0, "NAMEDIFF": 0, "POP_MAX": 3450000, "POP_MIN": 732072, "POP_OTHER": 27400, "RANK_MAX": 12, "RANK_MIN": 11, "GEONAMEID": 5391959, "MEGANAME": "San Francisco-Oakland", "LS_NAME": "San Francisco1", "LS_MATCH": 1, "CHECKME": 0, "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, "COMPARE": 0, "GN_ASCII": "San Francisco", "FEATURE_CL": "P", "FEATURE_CO": "PPL", "ADMIN1_COD": 0, "GN_POP": 732072, "ELEVATION": 16, "GTOPO30": 60, "TIMEZONE": "America/Los_Angeles", "GEONAMESNO": "GeoNames match with ascii name + lat + long whole numbers.", "UN_FID": 570, "UN_ADM0": "United States of America", "UN_LAT": 37.79, "UN_LONG": -122.38, "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, "CITYALT": "San Francisco" }, "geometry": { "type": "Point", "coordinates": [ -122.431641, 37.753344 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NATSCALE": 600, "LABELRANK": 1, "FEATURECLA": "Populated place", "NAME": "Los Angeles", "NAMEALT": "Los Angeles-Long Beach-Santa Ana", "DIFFASCII": 0, "NAMEASCII": "Los Angeles", "ADM0CAP": 0, "CAPALT": 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": 33.989978, "LONGITUDE": -118.179981, "CHANGED": 0, "NAMEDIFF": 0, "POP_MAX": 12500000, "POP_MIN": 3694820, "POP_OTHER": 142265, "RANK_MAX": 14, "RANK_MIN": 12, "GEONAMEID": 5368361, "MEGANAME": "Los Angeles-Long Beach-Santa Ana", "LS_NAME": "Los Angeles1", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 4976870, "MAX_POP20": 6558538, "MAX_POP50": 14868745, "MAX_POP300": 14870543, "MAX_POP310": 14903021, "MAX_NATSCA": 300, "MIN_AREAKM": 1338, "MAX_AREAKM": 5803, "MIN_AREAMI": 517, "MAX_AREAMI": 2241, "MIN_PERKM": 534, "MAX_PERKM": 2202, "MIN_PERMI": 332, "MAX_PERMI": 1369, "MIN_BBXMIN": -118.991667, "MAX_BBXMIN": -118.966667, "MIN_BBXMAX": -117.857183, "MAX_BBXMAX": -117.008333, "MIN_BBYMIN": 33.391667, "MAX_BBYMIN": 33.862631, "MIN_BBYMAX": 34.241667, "MAX_BBYMAX": 34.333333, "MEAN_BBXC": -118.107478, "MEAN_BBYC": 33.980609, "COMPARE": 0, "GN_ASCII": "Los Angeles", "FEATURE_CL": "P", "FEATURE_CO": "PPL", "ADMIN1_COD": 0, "GN_POP": 3694820, "ELEVATION": 89, "GTOPO30": 115, "TIMEZONE": "America/Los_Angeles", "GEONAMESNO": "GeoNames match with ascii name + lat + long whole numbers.", "UN_FID": 547, "UN_ADM0": "United States of America", "UN_LAT": 34, "UN_LONG": -118.25, "POP1950": 4046, "POP1955": 5154, "POP1960": 6530, "POP1965": 7408, "POP1970": 8378, "POP1975": 8926, "POP1980": 9512, "POP1985": 10181, "POP1990": 10883, "POP1995": 11339, "POP2000": 11814, "POP2005": 12307, "POP2010": 12500, "POP2015": 12773, "POP2020": 13160, "POP2025": 13461, "POP2050": 13672, "CITYALT": "Los Angeles" }, "geometry": { "type": "Point", "coordinates": [ -118.168945, 33.979809 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NATSCALE": 300, "LABELRANK": 1, "FEATURECLA": "Admin-1 capital", "NAME": "Denver", "NAMEALT": "Denver-Aurora", "DIFFASCII": 0, "NAMEASCII": "Denver", "ADM0CAP": 0, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "United States", "SOV_A3": "USA", "ADM0NAME": "United States of America", "ADM0_A3": "USA", "ADM1NAME": "Colorado", "ISO_A2": "US", "LATITUDE": 39.739188, "LONGITUDE": -104.984016, "CHANGED": 5, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 2313000, "POP_MIN": 1548599, "POP_OTHER": 1521278, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 5419384, "MEGANAME": "Denver-Aurora", "LS_NAME": "Denver", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 1548599, "MAX_POP20": 2100407, "MAX_POP50": 2174327, "MAX_POP300": 2174327, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 909, "MAX_AREAKM": 1345, "MIN_AREAMI": 351, "MAX_AREAMI": 519, "MIN_PERKM": 371, "MAX_PERKM": 606, "MIN_PERMI": 231, "MAX_PERMI": 376, "MIN_BBXMIN": -105.241667, "MAX_BBXMIN": -105.241667, "MIN_BBXMAX": -104.866667, "MAX_BBXMAX": -104.708333, "MIN_BBYMIN": 39.5, "MAX_BBYMIN": 39.5, "MIN_BBYMAX": 39.958333, "MAX_BBYMAX": 40.025, "MEAN_BBXC": -104.993967, "MEAN_BBYC": 39.72985, "COMPARE": 0, "GN_ASCII": "Denver", "ADMIN1_COD": 0, "GN_POP": 0, "ELEVATION": 0, "GTOPO30": 0, "GEONAMESNO": "GeoNames match general + researched.", "UN_FID": 537, "UN_ADM0": "United States of America", "UN_LAT": 39.57, "UN_LONG": -105.07, "POP1950": 505, "POP1955": 641, "POP1960": 809, "POP1965": 923, "POP1970": 1054, "POP1975": 1198, "POP1980": 1356, "POP1985": 1437, "POP1990": 1528, "POP1995": 1747, "POP2000": 1998, "POP2005": 2241, "POP2010": 2313, "POP2015": 2396, "POP2020": 2502, "POP2025": 2590, "POP2050": 2661, "CITYALT": "Denver" }, "geometry": { "type": "Point", "coordinates": [ -104.985352, 39.740986 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NATSCALE": 300, "LABELRANK": 2, "FEATURECLA": "Admin-1 capital", "NAME": "Monterrey", "DIFFASCII": 0, "NAMEASCII": "Monterrey", "ADM0CAP": 0, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Mexico", "SOV_A3": "MEX", "ADM0NAME": "Mexico", "ADM0_A3": "MEX", "ADM1NAME": "Nuevo León", "ISO_A2": "MX", "LATITUDE": 25.669995, "LONGITUDE": -100.329985, "CHANGED": 5, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 3712000, "POP_MIN": 1122874, "POP_OTHER": 3225636, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 3995465, "MEGANAME": "Monterrey", "LS_NAME": "Monterrey", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 3296184, "MAX_POP20": 3296184, "MAX_POP50": 3296184, "MAX_POP300": 3296184, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 594, "MAX_AREAKM": 594, "MIN_AREAMI": 229, "MAX_AREAMI": 229, "MIN_PERKM": 208, "MAX_PERKM": 208, "MIN_PERMI": 130, "MAX_PERMI": 130, "MIN_BBXMIN": -100.5, "MAX_BBXMIN": -100.5, "MIN_BBXMAX": -100.125, "MAX_BBXMAX": -100.125, "MIN_BBYMIN": 25.575, "MAX_BBYMIN": 25.575, "MIN_BBYMAX": 25.85, "MAX_BBYMAX": 25.85, "MEAN_BBXC": -100.290632, "MEAN_BBYC": 25.71613, "COMPARE": 0, "GN_ASCII": "Monterrey", "FEATURE_CL": "P", "FEATURE_CO": "PPL", "ADMIN1_COD": 19, "GN_POP": 1122874, "ELEVATION": 0, "GTOPO30": 563, "TIMEZONE": "America/Monterrey", "GEONAMESNO": "Geonames ascii name + lat.d + long.d matching.", "UN_FID": 359, "UN_ADM0": "Mexico", "UN_LAT": 25.67, "UN_LONG": -100.31, "POP1950": 356, "POP1955": 498, "POP1960": 698, "POP1965": 943, "POP1970": 1267, "POP1975": 1589, "POP1980": 1992, "POP1985": 2273, "POP1990": 2594, "POP1995": 2961, "POP2000": 3266, "POP2005": 3579, "POP2010": 3712, "POP2015": 3901, "POP2020": 4140, "POP2025": 4298, "POP2050": 4413 }, "geometry": { "type": "Point", "coordinates": [ -100.327148, 25.681137 ] } }
|
||||
@@ -128,8 +122,6 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NATSCALE": 110, "LABELRANK": 0, "FEATURECLA": "Admin-0 capital", "NAME": "Sao Tome", "DIFFASCII": 0, "NAMEASCII": "Sao Tome", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 0, "SOV0NAME": "Sao Tome and Principe", "SOV_A3": "STP", "ADM0NAME": "Sao Tome and Principe", "ADM0_A3": "STP", "ISO_A2": "ST", "LATITUDE": 0.333402, "LONGITUDE": 6.733325, "CHANGED": 0, "NAMEDIFF": 0, "POP_MAX": 88219, "POP_MIN": 56166, "POP_OTHER": 88219, "RANK_MAX": 8, "RANK_MIN": 8, "GEONAMEID": 3388092, "LS_NAME": "Sao Tome", "LS_MATCH": 1, "CHECKME": 5, "MAX_POP10": 88219, "MAX_POP20": 88219, "MAX_POP50": 88219, "MAX_POP300": 88219, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 32, "MAX_AREAKM": 32, "MIN_AREAMI": 12, "MAX_AREAMI": 12, "MIN_PERKM": 44, "MAX_PERKM": 44, "MIN_PERMI": 28, "MAX_PERMI": 28, "MIN_BBXMIN": 6.691667, "MAX_BBXMIN": 6.691667, "MIN_BBXMAX": 6.75, "MAX_BBXMAX": 6.75, "MIN_BBYMIN": 0.3, "MAX_BBYMIN": 0.3, "MIN_BBYMAX": 0.391667, "MAX_BBYMAX": 0.391667, "MEAN_BBXC": 6.719032, "MEAN_BBYC": 0.338176, "COMPARE": 0, "GN_ASCII": "Sao Tome", "FEATURE_CL": "P", "FEATURE_CO": "PPL", "ADMIN1_COD": 22, "GN_POP": 6137, "ELEVATION": 0, "GTOPO30": 151, "TIMEZONE": "America/Fortaleza", "GEONAMESNO": "GeoNames match general.", "UN_FID": 0, "UN_LAT": 0, "UN_LONG": 0, "POP1950": 0, "POP1955": 0, "POP1960": 0, "POP1965": 0, "POP1970": 0, "POP1975": 0, "POP1980": 0, "POP1985": 0, "POP1990": 0, "POP1995": 0, "POP2000": 0, "POP2005": 0, "POP2010": 0, "POP2015": 0, "POP2020": 0, "POP2025": 0, "POP2050": 0 }, "geometry": { "type": "Point", "coordinates": [ 6.723633, 0.351560 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NATSCALE": 110, "LABELRANK": 7, "FEATURECLA": "Admin-0 capital", "NAME": "Libreville", "DIFFASCII": 0, "NAMEASCII": "Libreville", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 0, "SOV0NAME": "Gabon", "SOV_A3": "GAB", "ADM0NAME": "Gabon", "ADM0_A3": "GAB", "ADM1NAME": "Estuaire", "ISO_A2": "GA", "LATITUDE": 0.385389, "LONGITUDE": 9.457965, "CHANGED": 0, "NAMEDIFF": 0, "POP_MAX": 578156, "POP_MIN": 483355, "POP_OTHER": 483522, "RANK_MAX": 11, "RANK_MIN": 10, "GEONAMEID": 2399697, "LS_NAME": "Libreville", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 483355, "MAX_POP20": 483355, "MAX_POP50": 483355, "MAX_POP300": 483355, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 108, "MAX_AREAKM": 108, "MIN_AREAMI": 42, "MAX_AREAMI": 42, "MIN_PERKM": 98, "MAX_PERKM": 98, "MIN_PERMI": 61, "MAX_PERMI": 61, "MIN_BBXMIN": 9.4, "MAX_BBXMIN": 9.4, "MIN_BBXMAX": 9.525, "MAX_BBXMAX": 9.525, "MIN_BBYMIN": 0.283333, "MAX_BBYMIN": 0.283333, "MIN_BBYMAX": 0.483333, "MAX_BBYMAX": 0.483333, "MEAN_BBXC": 9.47328, "MEAN_BBYC": 0.395238, "COMPARE": 0, "GN_ASCII": "Libreville", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 1, "GN_POP": 578156, "ELEVATION": 0, "GTOPO30": -9999, "TIMEZONE": "Africa/Libreville", "GEONAMESNO": "GeoNames match general.", "UN_FID": 0, "UN_LAT": 0, "UN_LONG": 0, "POP1950": 0, "POP1955": 0, "POP1960": 0, "POP1965": 0, "POP1970": 0, "POP1975": 0, "POP1980": 0, "POP1985": 0, "POP1990": 0, "POP1995": 0, "POP2000": 0, "POP2005": 0, "POP2010": 0, "POP2015": 0, "POP2020": 0, "POP2025": 0, "POP2050": 0 }, "geometry": { "type": "Point", "coordinates": [ 9.448242, 0.395505 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NATSCALE": 110, "LABELRANK": 5, "FEATURECLA": "Admin-0 capital", "NAME": "Kampala", "DIFFASCII": 0, "NAMEASCII": "Kampala", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Uganda", "SOV_A3": "UGA", "ADM0NAME": "Uganda", "ADM0_A3": "UGA", "ADM1NAME": "Kampala", "ISO_A2": "UG", "LATITUDE": 0.316659, "LONGITUDE": 32.583324, "CHANGED": 0, "NAMEDIFF": 0, "POP_MAX": 1420000, "POP_MIN": 1353189, "POP_OTHER": 2153702, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 232422, "MEGANAME": "Kampala", "LS_NAME": "Kampala", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 2155592, "MAX_POP20": 2153391, "MAX_POP50": 2322955, "MAX_POP300": 2322955, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 405, "MAX_AREAKM": 465, "MIN_AREAMI": 156, "MAX_AREAMI": 180, "MIN_PERKM": 391, "MAX_PERKM": 470, "MIN_PERMI": 243, "MAX_PERMI": 292, "MIN_BBXMIN": 32.45, "MAX_BBXMIN": 32.5, "MIN_BBXMAX": 32.8, "MAX_BBXMAX": 32.8, "MIN_BBYMIN": 0.033333, "MAX_BBYMIN": 0.166719, "MIN_BBYMAX": 0.475, "MAX_BBYMAX": 0.475, "MEAN_BBXC": 32.614686, "MEAN_BBYC": 0.323809, "COMPARE": 0, "GN_ASCII": "Kampala", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 18, "GN_POP": 1353189, "ELEVATION": 0, "GTOPO30": 1206, "TIMEZONE": "Africa/Kampala", "GEONAMESNO": "GeoNames match general.", "UN_FID": 507, "UN_ADM0": "Uganda", "UN_LAT": 0.32, "UN_LONG": 32.57, "POP1950": 95, "POP1955": 110, "POP1960": 137, "POP1965": 222, "POP1970": 340, "POP1975": 398, "POP1980": 469, "POP1985": 595, "POP1990": 755, "POP1995": 912, "POP2000": 1097, "POP2005": 1318, "POP2010": 1420, "POP2015": 1597, "POP2020": 1979, "POP2025": 2506, "POP2050": 3198 }, "geometry": { "type": "Point", "coordinates": [ 32.563477, 0.307616 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NATSCALE": 110, "LABELRANK": 8, "FEATURECLA": "Admin-0 capital", "NAME": "Mogadishu", "NAMEALT": "Muqdisho", "DIFFASCII": 0, "NAMEASCII": "Mogadishu", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Somalia", "SOV_A3": "SOM", "ADM0NAME": "Somalia", "ADM0_A3": "SOM", "ADM1NAME": "Banaadir", "ISO_A2": "SO", "LATITUDE": 2.066681, "LONGITUDE": 45.366678, "CHANGED": 0, "NAMEDIFF": 0, "POP_MAX": 1100000, "POP_MIN": 875388, "POP_OTHER": 849392, "RANK_MAX": 12, "RANK_MIN": 11, "GEONAMEID": 53654, "MEGANAME": "Muqdisho", "LS_NAME": "Mogadishu", "LS_MATCH": 1, "CHECKME": 5, "MAX_POP10": 875388, "MAX_POP20": 875388, "MAX_POP50": 875388, "MAX_POP300": 875388, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 99, "MAX_AREAKM": 99, "MIN_AREAMI": 38, "MAX_AREAMI": 38, "MIN_PERKM": 68, "MAX_PERKM": 68, "MIN_PERMI": 43, "MAX_PERMI": 43, "MIN_BBXMIN": 45.25, "MAX_BBXMIN": 45.25, "MIN_BBXMAX": 45.416667, "MAX_BBXMAX": 45.416667, "MIN_BBYMIN": 2, "MAX_BBYMIN": 2, "MIN_BBYMAX": 2.116667, "MAX_BBYMAX": 2.116667, "MEAN_BBXC": 45.331178, "MEAN_BBYC": 2.054239, "COMPARE": 0, "GN_ASCII": "Mogadishu", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 2, "GN_POP": 2587183, "ELEVATION": 0, "GTOPO30": 39, "TIMEZONE": "Africa/Mogadishu", "GEONAMESNO": "GeoNames match general.", "UN_FID": 454, "UN_ADM0": "Somalia", "UN_LAT": 2.04, "UN_LONG": 45.34, "POP1950": 69, "POP1955": 73, "POP1960": 94, "POP1965": 146, "POP1970": 272, "POP1975": 445, "POP1980": 551, "POP1985": 747, "POP1990": 1035, "POP1995": 1147, "POP2000": 1201, "POP2005": 1415, "POP2010": 1100, "POP2015": 1500, "POP2020": 1794, "POP2025": 2142, "POP2050": 2529, "CITYALT": "Mogadishu" }, "geometry": { "type": "Point", "coordinates": [ 45.351562, 2.064982 ] } }
|
||||
@@ -168,8 +160,6 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NATSCALE": 110, "LABELRANK": 8, "FEATURECLA": "Admin-0 capital", "NAME": "Ouagadougou", "DIFFASCII": 0, "NAMEASCII": "Ouagadougou", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Burkina Faso", "SOV_A3": "BFA", "ADM0NAME": "Burkina Faso", "ADM0_A3": "BFA", "ADM1NAME": "Kadiogo", "ISO_A2": "BF", "LATITUDE": 12.370316, "LONGITUDE": -1.524724, "CHANGED": 0, "NAMEDIFF": 0, "POP_MAX": 1149000, "POP_MIN": 835457, "POP_OTHER": 713874, "RANK_MAX": 12, "RANK_MIN": 11, "GEONAMEID": 2357048, "MEGANAME": "Ouagadougou", "LS_NAME": "Ouagadougou", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 835457, "MAX_POP20": 835457, "MAX_POP50": 835457, "MAX_POP300": 835457, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 236, "MAX_AREAKM": 236, "MIN_AREAMI": 91, "MAX_AREAMI": 91, "MIN_PERKM": 133, "MAX_PERKM": 133, "MIN_PERMI": 83, "MAX_PERMI": 83, "MIN_BBXMIN": -1.616667, "MAX_BBXMIN": -1.616667, "MIN_BBXMAX": -1.433333, "MAX_BBXMAX": -1.433333, "MIN_BBYMIN": 12.275, "MAX_BBYMIN": 12.275, "MIN_BBYMAX": 12.483333, "MAX_BBYMAX": 12.483333, "MEAN_BBXC": -1.521746, "MEAN_BBYC": 12.365975, "COMPARE": 0, "GN_ASCII": "Ouagadougou", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 53, "GN_POP": 1086505, "ELEVATION": 0, "GTOPO30": 307, "TIMEZONE": "Africa/Ouagadougou", "GEONAMESNO": "GeoNames match general.", "UN_FID": 578, "UN_ADM0": "Burkina Faso", "UN_LAT": 12.48, "UN_LONG": -1.67, "POP1950": 33, "POP1955": 46, "POP1960": 59, "POP1965": 82, "POP1970": 111, "POP1975": 149, "POP1980": 257, "POP1985": 424, "POP1990": 537, "POP1995": 667, "POP2000": 828, "POP2005": 1044, "POP2010": 1149, "POP2015": 1324, "POP2020": 1676, "POP2025": 2111, "POP2050": 2632 }, "geometry": { "type": "Point", "coordinates": [ -1.538086, 12.382928 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 2, "NATSCALE": 200, "LABELRANK": 6, "FEATURECLA": "Admin-0 capital", "NAME": "Accra", "DIFFASCII": 0, "NAMEASCII": "Accra", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "Ghana", "SOV_A3": "GHA", "ADM0NAME": "Ghana", "ADM0_A3": "GHA", "ADM1NAME": "Greater Accra", "ISO_A2": "GH", "LATITUDE": 5.550035, "LONGITUDE": -0.216716, "CHANGED": 5, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 2121000, "POP_MIN": 1963264, "POP_OTHER": 2334371, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 2306104, "MEGANAME": "Accra", "LS_NAME": "Accra", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 2359119, "MAX_POP20": 2941045, "MAX_POP50": 2941045, "MAX_POP300": 2941045, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 443, "MAX_AREAKM": 636, "MIN_AREAMI": 171, "MAX_AREAMI": 245, "MIN_PERKM": 244, "MAX_PERKM": 345, "MIN_PERMI": 152, "MAX_PERMI": 214, "MIN_BBXMIN": -0.35, "MAX_BBXMIN": -0.35, "MIN_BBXMAX": -0.098725, "MAX_BBXMAX": 0.033333, "MIN_BBYMIN": 5.516667, "MAX_BBYMIN": 5.516667, "MIN_BBYMAX": 5.775, "MAX_BBYMAX": 5.775, "MEAN_BBXC": -0.188893, "MEAN_BBYC": 5.637403, "COMPARE": 0, "GN_ASCII": "Accra", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 1, "GN_POP": 1963264, "ELEVATION": 0, "GTOPO30": 104, "TIMEZONE": "Africa/Accra", "GEONAMESNO": "GeoNames match general.", "UN_FID": 196, "UN_ADM0": "Ghana", "UN_LAT": 5.55, "UN_LONG": -0.2, "POP1950": 177, "POP1955": 265, "POP1960": 393, "POP1965": 499, "POP1970": 631, "POP1975": 738, "POP1980": 863, "POP1985": 1013, "POP1990": 1197, "POP1995": 1415, "POP2000": 1674, "POP2005": 1984, "POP2010": 2121, "POP2015": 2332, "POP2020": 2688, "POP2025": 3041, "POP2050": 3382 }, "geometry": { "type": "Point", "coordinates": [ -0.219727, 5.572250 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 2, "NATSCALE": 200, "LABELRANK": 7, "FEATURECLA": "Admin-0 capital", "NAME": "Oslo", "DIFFASCII": 0, "NAMEASCII": "Oslo", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 1, "MEGACITY": 1, "SOV0NAME": "Kingdom of Norway", "SOV_A3": "NOR", "ADM0NAME": "Norway", "ADM0_A3": "NOR", "ADM1NAME": "Oslo", "ISO_A2": "NO", "LATITUDE": 59.91669, "LONGITUDE": 10.749979, "CHANGED": 4, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 835000, "POP_MIN": 580000, "POP_OTHER": 701804, "RANK_MAX": 11, "RANK_MIN": 11, "GEONAMEID": 3143244, "MEGANAME": "Oslo", "LS_NAME": "Oslo", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 731563, "MAX_POP20": 731563, "MAX_POP50": 762374, "MAX_POP300": 762374, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 329, "MAX_AREAKM": 362, "MIN_AREAMI": 127, "MAX_AREAMI": 140, "MIN_PERKM": 340, "MAX_PERKM": 390, "MIN_PERMI": 211, "MAX_PERMI": 243, "MIN_BBXMIN": 10.333333, "MAX_BBXMIN": 10.440355, "MIN_BBXMAX": 11.091667, "MAX_BBXMAX": 11.091667, "MIN_BBYMIN": 59.708333, "MAX_BBYMIN": 59.708333, "MIN_BBYMAX": 60.066667, "MAX_BBYMAX": 60.066667, "MEAN_BBXC": 10.756508, "MEAN_BBYC": 59.906118, "COMPARE": 0, "GN_ASCII": "Oslo", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 12, "GN_POP": 580000, "ELEVATION": 0, "GTOPO30": 11, "TIMEZONE": "Europe/Oslo", "GEONAMESNO": "GeoNames match general.", "UN_FID": 397, "UN_ADM0": "Norway", "UN_LAT": 59.93, "UN_LONG": 10.71, "POP1950": 468, "POP1955": 533, "POP1960": 578, "POP1965": 610, "POP1970": 643, "POP1975": 644, "POP1980": 643, "POP1985": 662, "POP1990": 684, "POP1995": 729, "POP2000": 774, "POP2005": 816, "POP2010": 835, "POP2015": 858, "POP2020": 885, "POP2025": 909, "POP2050": 936 }, "geometry": { "type": "Point", "coordinates": [ 10.766602, 59.910976 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NATSCALE": 300, "LABELRANK": 7, "FEATURECLA": "Admin-0 capital", "NAME": "Stockholm", "DIFFASCII": 0, "NAMEASCII": "Stockholm", "ADM0CAP": 1, "CAPALT": 0, "WORLDCITY": 1, "MEGACITY": 1, "SOV0NAME": "Sweden", "SOV_A3": "SWE", "ADM0NAME": "Sweden", "ADM0_A3": "SWE", "ADM1NAME": "Stockholm", "ISO_A2": "SE", "LATITUDE": 59.35076, "LONGITUDE": 18.097335, "CHANGED": 4, "NAMEDIFF": 0, "DIFFNOTE": "Location adjusted.", "POP_MAX": 1264000, "POP_MIN": 1253309, "POP_OTHER": 0, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 2673730, "MEGANAME": "Stockholm", "LS_NAME": "Stockholm", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 1337078, "MAX_POP20": 1337078, "MAX_POP50": 1337078, "MAX_POP300": 1337078, "MAX_POP310": 1337078, "MAX_NATSCA": 300, "MIN_AREAKM": 694, "MAX_AREAKM": 694, "MIN_AREAMI": 268, "MAX_AREAMI": 268, "MIN_PERKM": 629, "MAX_PERKM": 629, "MIN_PERMI": 391, "MAX_PERMI": 391, "MIN_BBXMIN": 17.775, "MAX_BBXMIN": 17.775, "MIN_BBXMAX": 18.408333, "MAX_BBXMAX": 18.408333, "MIN_BBYMIN": 59.091667, "MAX_BBYMIN": 59.091667, "MIN_BBYMAX": 59.558333, "MAX_BBYMAX": 59.558333, "MEAN_BBXC": 18.044982, "MEAN_BBYC": 59.32868, "COMPARE": 0, "GN_ASCII": "Stockholm", "FEATURE_CL": "P", "FEATURE_CO": "PPLC", "ADMIN1_COD": 26, "GN_POP": 1253309, "ELEVATION": 0, "GTOPO30": 20, "TIMEZONE": "Europe/Stockholm", "GEONAMESNO": "GeoNames match general.", "UN_FID": 467, "UN_ADM0": "Sweden", "UN_LAT": 59.33, "UN_LONG": 17.99, "POP1950": 741, "POP1955": 772, "POP1960": 805, "POP1965": 1003, "POP1970": 1035, "POP1975": 1015, "POP1980": 992, "POP1985": 1012, "POP1990": 1038, "POP1995": 1138, "POP2000": 1206, "POP2005": 1248, "POP2010": 1264, "POP2015": 1285, "POP2020": 1308, "POP2025": 1326, "POP2050": 1343 }, "geometry": { "type": "Point", "coordinates": [ 18.105469, 59.355596 ] } }
|
||||
|
||||
+2
-2
@@ -25,7 +25,6 @@
|
||||
#include <pthread.h>
|
||||
#include "mvt.hpp"
|
||||
#include "projection.hpp"
|
||||
#include "pool.hpp"
|
||||
#include "mbtiles.hpp"
|
||||
#include "geometry.hpp"
|
||||
#include "dirtiles.hpp"
|
||||
@@ -545,7 +544,7 @@ void *join_worker(void *v) {
|
||||
std::string compressed;
|
||||
|
||||
if (!pC) {
|
||||
compress(pbf, compressed);
|
||||
compress(pbf, compressed, true);
|
||||
} else {
|
||||
compressed = pbf;
|
||||
}
|
||||
@@ -589,6 +588,7 @@ void handle_tasks(std::map<zxy, std::vector<std::string>> &tasks, std::vector<st
|
||||
if (ai == tasks.begin()) {
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "%lld/%lld/%lld \r", ai->first.z, ai->first.x, ai->first.y);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include <zlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include "mvt.hpp"
|
||||
#include "mbtiles.hpp"
|
||||
@@ -40,6 +41,7 @@
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "evaluator.hpp"
|
||||
#include "errors.hpp"
|
||||
#include "protozero/varint.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "jsonpull/jsonpull.h"
|
||||
@@ -47,6 +49,280 @@ extern "C" {
|
||||
|
||||
#include "plugin.hpp"
|
||||
|
||||
struct decompressor {
|
||||
FILE *fp = NULL;
|
||||
z_stream zs;
|
||||
std::string buf;
|
||||
bool within = false;
|
||||
|
||||
decompressor(FILE *f) {
|
||||
fp = f;
|
||||
buf.resize(5000);
|
||||
|
||||
zs.next_in = (Bytef *) buf.c_str();
|
||||
zs.avail_in = 0;
|
||||
}
|
||||
|
||||
decompressor() { }
|
||||
|
||||
void begin() {
|
||||
within = true;
|
||||
|
||||
zs.zalloc = NULL;
|
||||
zs.zfree = NULL;
|
||||
zs.opaque = NULL;
|
||||
zs.msg = (char *) "";
|
||||
|
||||
int d = inflateInit(&zs);
|
||||
if (d != Z_OK) {
|
||||
fprintf(stderr, "initialize decompression: %d %s\n", d, zs.msg);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
int fread(void *p, size_t size, size_t nmemb, std::atomic<long long> *geompos) {
|
||||
zs.next_out = (Bytef *) p;
|
||||
zs.avail_out = size * nmemb;
|
||||
|
||||
while (zs.avail_out > 0) {
|
||||
if (zs.avail_in == 0) {
|
||||
size_t n = ::fread((Bytef *) buf.c_str(), sizeof(char), buf.size(), fp);
|
||||
if (n == 0) {
|
||||
if (within) {
|
||||
fprintf(stderr, "Reached EOF while decompressing\n");
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
zs.next_in = (Bytef *) buf.c_str();
|
||||
zs.avail_in = n;
|
||||
}
|
||||
|
||||
size_t avail_before = zs.avail_in;
|
||||
|
||||
if (within) {
|
||||
int d = inflate(&zs, Z_NO_FLUSH);
|
||||
*geompos += avail_before - zs.avail_in;
|
||||
|
||||
if (d == Z_OK) {
|
||||
// it made some progress
|
||||
} else if (d == Z_STREAM_END) {
|
||||
// it may have made some progress and now we are done
|
||||
within = false;
|
||||
break;
|
||||
} else {
|
||||
fprintf(stderr, "decompression error %d %s\n", d, zs.msg);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
} else {
|
||||
size_t n = std::min(zs.avail_in, zs.avail_out);
|
||||
memcpy(zs.next_out, zs.next_in, n);
|
||||
*geompos += n;
|
||||
|
||||
zs.avail_out -= n;
|
||||
zs.avail_in -= n;
|
||||
zs.next_out += n;
|
||||
zs.next_in += n;
|
||||
}
|
||||
}
|
||||
|
||||
return (size * nmemb - zs.avail_out) / size;
|
||||
}
|
||||
|
||||
void end(std::atomic<long long> *) {
|
||||
if (zs.avail_in == 0) {
|
||||
size_t n = ::fread((Bytef *) buf.c_str(), sizeof(char), buf.size(), fp);
|
||||
zs.next_in = (Bytef *) buf.c_str();
|
||||
zs.avail_in = n;
|
||||
}
|
||||
|
||||
if (within) {
|
||||
zs.avail_out = 0;
|
||||
int d = inflate(&zs, Z_NO_FLUSH);
|
||||
if (d != Z_STREAM_END) {
|
||||
fprintf(stderr, "decompression: got %d, not Z_STREAM_END\n", d);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
within = false;
|
||||
|
||||
int d = inflateEnd(&zs);
|
||||
if (d != Z_OK) {
|
||||
fprintf(stderr, "end decompression: %d %s\n", d, zs.msg);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
int deserialize_ulong_long(unsigned long long *zigzag, std::atomic<long long> *geompos) {
|
||||
*zigzag = 0;
|
||||
int shift = 0;
|
||||
|
||||
while (1) {
|
||||
char c;
|
||||
if (fread(&c, sizeof(char), 1, geompos) != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((c & 0x80) == 0) {
|
||||
*zigzag |= ((unsigned long long) c) << shift;
|
||||
shift += 7;
|
||||
break;
|
||||
} else {
|
||||
*zigzag |= ((unsigned long long) (c & 0x7F)) << shift;
|
||||
shift += 7;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int deserialize_long_long(long long *n, std::atomic<long long> *geompos) {
|
||||
unsigned long long zigzag = 0;
|
||||
int ret = deserialize_ulong_long(&zigzag, geompos);
|
||||
*n = protozero::decode_zigzag64(zigzag);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int deserialize_int(int *n, std::atomic<long long> *geompos) {
|
||||
long long ll = 0;
|
||||
int ret = deserialize_long_long(&ll, geompos);
|
||||
*n = ll;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int deserialize_uint(unsigned *n, std::atomic<long long> *geompos) {
|
||||
unsigned long long v;
|
||||
deserialize_ulong_long(&v, geompos);
|
||||
*n = v;
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
struct compressor {
|
||||
FILE *fp = NULL;
|
||||
z_stream zs;
|
||||
|
||||
compressor(FILE *f) {
|
||||
fp = f;
|
||||
}
|
||||
|
||||
compressor() { }
|
||||
|
||||
void begin() {
|
||||
zs.zalloc = NULL;
|
||||
zs.zfree = NULL;
|
||||
zs.opaque = NULL;
|
||||
zs.msg = (char *) "";
|
||||
|
||||
int d = deflateInit(&zs, Z_DEFAULT_COMPRESSION);
|
||||
if (d != Z_OK) {
|
||||
fprintf(stderr, "initialize compression: %d %s\n", d, zs.msg);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
void end(std::atomic<long long> *fpos, const char *fname) {
|
||||
std::string buf;
|
||||
buf.resize(5000);
|
||||
|
||||
if (zs.avail_in != 0) {
|
||||
fprintf(stderr, "compression end called with data available\n");
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
zs.next_in = (Bytef *) buf.c_str();
|
||||
zs.avail_in = 0;
|
||||
|
||||
while (true) {
|
||||
zs.next_out = (Bytef *) buf.c_str();
|
||||
zs.avail_out = buf.size();
|
||||
|
||||
int d = deflate(&zs, Z_FINISH);
|
||||
::fwrite_check(buf.c_str(), sizeof(char), zs.next_out - (Bytef *) buf.c_str(), fp, fpos, fname);
|
||||
|
||||
if (d == Z_OK || d == Z_BUF_ERROR) {
|
||||
// it can take several calls to flush out all the buffered data
|
||||
continue;
|
||||
}
|
||||
|
||||
if (d != Z_STREAM_END) {
|
||||
fprintf(stderr, "%s: finish compression: %d %s\n", fname, d, zs.msg);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
zs.next_out = (Bytef *) buf.c_str();
|
||||
zs.avail_out = buf.size();
|
||||
|
||||
int d = deflateEnd(&zs);
|
||||
if (d != Z_OK) {
|
||||
fprintf(stderr, "%s: end compression: %d %s\n", fname, d, zs.msg);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
::fwrite_check(buf.c_str(), sizeof(char), zs.next_out - (Bytef *) buf.c_str(), fp, fpos, fname);
|
||||
|
||||
// ::fwrite_check("aaaaaaaaa", 1, 9, fp, fpos, fname);
|
||||
}
|
||||
|
||||
int fclose() {
|
||||
return ::fclose(fp);
|
||||
}
|
||||
|
||||
void fwrite_check(const char *p, size_t size, size_t nmemb, std::atomic<long long> *fpos, const char *fname) {
|
||||
std::string buf;
|
||||
buf.resize(size * nmemb * 2 + 200);
|
||||
|
||||
zs.next_in = (Bytef *) p;
|
||||
zs.avail_in = size * nmemb;
|
||||
|
||||
while (zs.avail_in > 0) {
|
||||
zs.next_out = (Bytef *) buf.c_str();
|
||||
zs.avail_out = buf.size();
|
||||
|
||||
int d = deflate(&zs, Z_NO_FLUSH);
|
||||
if (d != Z_OK) {
|
||||
fprintf(stderr, "%s: deflate: %d %s\n", fname, d, zs.msg);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
::fwrite_check(buf.c_str(), sizeof(char), zs.next_out - (Bytef *) buf.c_str(), fp, fpos, fname);
|
||||
}
|
||||
}
|
||||
|
||||
void serialize_ulong_long(unsigned long long val, std::atomic<long long> *fpos, const char *fname) {
|
||||
while (1) {
|
||||
unsigned char b = val & 0x7F;
|
||||
if ((val >> 7) != 0) {
|
||||
b |= 0x80;
|
||||
fwrite_check((const char *) &b, 1, 1, fpos, fname);
|
||||
val >>= 7;
|
||||
} else {
|
||||
fwrite_check((const char *) &b, 1, 1, fpos, fname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void serialize_long_long(long long val, std::atomic<long long> *fpos, const char *fname) {
|
||||
unsigned long long zigzag = protozero::encode_zigzag64(val);
|
||||
|
||||
serialize_ulong_long(zigzag, fpos, fname);
|
||||
}
|
||||
|
||||
void serialize_int(int val, std::atomic<long long> *fpos, const char *fname) {
|
||||
serialize_long_long(val, fpos, fname);
|
||||
}
|
||||
|
||||
void serialize_uint(unsigned val, std::atomic<long long> *fpos, const char *fname) {
|
||||
serialize_ulong_long(val, fpos, fname);
|
||||
}
|
||||
};
|
||||
|
||||
#define CMD_BITS 3
|
||||
|
||||
// Offset coordinates to keep them positive
|
||||
@@ -328,7 +604,7 @@ struct ordercmp {
|
||||
}
|
||||
} ordercmp;
|
||||
|
||||
void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, unsigned tx, unsigned ty, int buffer, int *within, std::atomic<long long> *geompos, FILE **geomfile, const char *fname, signed char t, int layer, long long metastart, signed char feature_minzoom, int child_shards, int max_zoom_increment, long long seq, int tippecanoe_minzoom, int tippecanoe_maxzoom, int segment, unsigned *initial_x, unsigned *initial_y, std::vector<long long> &metakeys, std::vector<long long> &metavals, bool has_id, unsigned long long id, unsigned long long index, unsigned long long label_point, long long extent) {
|
||||
void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, unsigned tx, unsigned ty, int buffer, int *within, std::atomic<long long> *geompos, compressor **geomfile, const char *fname, signed char t, int layer, signed char feature_minzoom, int child_shards, int max_zoom_increment, long long seq, int tippecanoe_minzoom, int tippecanoe_maxzoom, int segment, unsigned *initial_x, unsigned *initial_y, std::vector<long long> &metakeys, std::vector<long long> &metavals, bool has_id, unsigned long long id, unsigned long long index, unsigned long long label_point, long long extent) {
|
||||
if (geom.size() > 0 && (nextzoom <= maxzoom || additional[A_EXTEND_ZOOMS])) {
|
||||
int xo, yo;
|
||||
int span = 1 << (nextzoom - z);
|
||||
@@ -398,9 +674,10 @@ void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, u
|
||||
|
||||
{
|
||||
if (!within[j]) {
|
||||
serialize_int(geomfile[j], nextzoom, &geompos[j], fname);
|
||||
serialize_uint(geomfile[j], tx * span + xo, &geompos[j], fname);
|
||||
serialize_uint(geomfile[j], ty * span + yo, &geompos[j], fname);
|
||||
serialize_int(geomfile[j]->fp, nextzoom, &geompos[j], fname);
|
||||
serialize_uint(geomfile[j]->fp, tx * span + xo, &geompos[j], fname);
|
||||
serialize_uint(geomfile[j]->fp, ty * span + yo, &geompos[j], fname);
|
||||
geomfile[j]->begin();
|
||||
within[j] = 1;
|
||||
}
|
||||
|
||||
@@ -415,21 +692,20 @@ void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, u
|
||||
sf.tippecanoe_minzoom = tippecanoe_minzoom;
|
||||
sf.has_tippecanoe_maxzoom = tippecanoe_maxzoom != -1;
|
||||
sf.tippecanoe_maxzoom = tippecanoe_maxzoom;
|
||||
sf.metapos = metastart;
|
||||
sf.geometry = geom2;
|
||||
sf.index = index;
|
||||
sf.label_point = label_point;
|
||||
sf.extent = extent;
|
||||
sf.feature_minzoom = feature_minzoom;
|
||||
|
||||
if (metastart < 0) {
|
||||
for (size_t i = 0; i < metakeys.size(); i++) {
|
||||
sf.keys.push_back(metakeys[i]);
|
||||
sf.values.push_back(metavals[i]);
|
||||
}
|
||||
for (size_t i = 0; i < metakeys.size(); i++) {
|
||||
sf.keys.push_back(metakeys[i]);
|
||||
sf.values.push_back(metavals[i]);
|
||||
}
|
||||
|
||||
serialize_feature(geomfile[j], &sf, &geompos[j], fname, SHIFT_RIGHT(initial_x[segment]), SHIFT_RIGHT(initial_y[segment]), true);
|
||||
std::string feature = serialize_feature(&sf, SHIFT_RIGHT(initial_x[segment]), SHIFT_RIGHT(initial_y[segment]));
|
||||
geomfile[j]->serialize_long_long(feature.size(), &geompos[j], fname);
|
||||
geomfile[j]->fwrite_check(feature.c_str(), sizeof(char), feature.size(), &geompos[j], fname);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1287,14 +1563,13 @@ long long choose_minextent(std::vector<long long> &extents, double f) {
|
||||
|
||||
struct write_tile_args {
|
||||
struct task *tasks = NULL;
|
||||
char *metabase = NULL;
|
||||
char *stringpool = NULL;
|
||||
int min_detail = 0;
|
||||
sqlite3 *outdb = NULL;
|
||||
const char *outdir = NULL;
|
||||
int buffer = 0;
|
||||
const char *fname = NULL;
|
||||
FILE **geomfile = NULL;
|
||||
compressor **geomfile = NULL;
|
||||
double todo = 0;
|
||||
std::atomic<long long> *along = NULL;
|
||||
double gamma = 0;
|
||||
@@ -1310,7 +1585,6 @@ struct write_tile_args {
|
||||
int low_detail = 0;
|
||||
double simplification = 0;
|
||||
std::atomic<long long> *most = NULL;
|
||||
long long *meta_off = NULL;
|
||||
long long *pool_off = NULL;
|
||||
unsigned *initial_x = NULL;
|
||||
unsigned *initial_y = NULL;
|
||||
@@ -1336,6 +1610,8 @@ struct write_tile_args {
|
||||
struct json_object *filter = NULL;
|
||||
std::atomic<size_t> *dropped_count = NULL;
|
||||
atomic_strategy *strategy = NULL;
|
||||
int zoom = -1;
|
||||
bool compressed;
|
||||
};
|
||||
|
||||
bool clip_to_tile(serial_feature &sf, int z, long long buffer) {
|
||||
@@ -1433,18 +1709,44 @@ void remove_attributes(serial_feature &sf, std::set<std::string> const &exclude_
|
||||
}
|
||||
}
|
||||
|
||||
serial_feature next_feature(FILE *geoms, std::atomic<long long> *geompos_in, char *metabase, long long *meta_off, int z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y, long long *original_features, long long *unclipped_features, int nextzoom, int maxzoom, int minzoom, int max_zoom_increment, size_t pass, std::atomic<long long> *along, long long alongminus, int buffer, int *within, FILE **geomfile, std::atomic<long long> *geompos, std::atomic<double> *oprogress, double todo, const char *fname, int child_shards, struct json_object *filter, const char *stringpool, long long *pool_off, std::vector<std::vector<std::string>> *layer_unmaps, bool first_time) {
|
||||
serial_feature next_feature(decompressor *geoms, std::atomic<long long> *geompos_in, int z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y, long long *original_features, long long *unclipped_features, int nextzoom, int maxzoom, int minzoom, int max_zoom_increment, size_t pass, std::atomic<long long> *along, long long alongminus, int buffer, int *within, compressor **geomfile, std::atomic<long long> *geompos, std::atomic<double> *oprogress, double todo, const char *fname, int child_shards, struct json_object *filter, const char *stringpool, long long *pool_off, std::vector<std::vector<std::string>> *layer_unmaps, bool first_time, bool compressed) {
|
||||
while (1) {
|
||||
serial_feature sf = deserialize_feature(geoms, geompos_in, metabase, meta_off, z, tx, ty, initial_x, initial_y);
|
||||
if (sf.t < 0) {
|
||||
serial_feature sf;
|
||||
std::string s;
|
||||
long long len;
|
||||
|
||||
if (geoms->deserialize_long_long(&len, geompos_in) == 0) {
|
||||
if (compressed) {
|
||||
geoms->end(geompos_in);
|
||||
}
|
||||
|
||||
sf.t = -2;
|
||||
return sf;
|
||||
}
|
||||
if (len == 0) {
|
||||
if (compressed) {
|
||||
geoms->end(geompos_in);
|
||||
}
|
||||
|
||||
sf.t = -2;
|
||||
return sf;
|
||||
}
|
||||
|
||||
s.resize(std::abs(len));
|
||||
size_t n = geoms->fread((void *) s.c_str(), sizeof(char), s.size(), geompos_in);
|
||||
if (n != s.size()) {
|
||||
fprintf(stderr, "Short read (%zu for %zu) from geometry\n", n, s.size());
|
||||
exit(EXIT_READ);
|
||||
}
|
||||
|
||||
sf = deserialize_feature(s, z, tx, ty, initial_x, initial_y);
|
||||
|
||||
size_t passes = pass + 1;
|
||||
double progress = floor(((((*geompos_in + *along - alongminus) / (double) todo) + pass) / passes + z) / (maxzoom + 1) * 1000) / 10;
|
||||
if (progress >= *oprogress + 0.1) {
|
||||
if (!quiet && !quiet_progress && progress_time()) {
|
||||
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
|
||||
fflush(stderr);
|
||||
}
|
||||
if (logger.json_enabled && progress_time()) {
|
||||
logger.progress_tile(progress);
|
||||
@@ -1464,7 +1766,7 @@ serial_feature next_feature(FILE *geoms, std::atomic<long long> *geompos_in, cha
|
||||
|
||||
if (first_time && pass == 0) { /* only write out the next zoom once, even if we retry */
|
||||
if (sf.tippecanoe_maxzoom == -1 || sf.tippecanoe_maxzoom >= nextzoom) {
|
||||
rewrite(sf.geometry, z, nextzoom, maxzoom, sf.bbox, tx, ty, buffer, within, geompos, geomfile, fname, sf.t, sf.layer, sf.metapos, sf.feature_minzoom, child_shards, max_zoom_increment, sf.seq, sf.tippecanoe_minzoom, sf.tippecanoe_maxzoom, sf.segment, initial_x, initial_y, sf.keys, sf.values, sf.has_id, sf.id, sf.index, sf.label_point, sf.extent);
|
||||
rewrite(sf.geometry, z, nextzoom, maxzoom, sf.bbox, tx, ty, buffer, within, geompos, geomfile, fname, sf.t, sf.layer, sf.feature_minzoom, child_shards, max_zoom_increment, sf.seq, sf.tippecanoe_minzoom, sf.tippecanoe_maxzoom, sf.segment, initial_x, initial_y, sf.keys, sf.values, sf.has_id, sf.id, sf.index, sf.label_point, sf.extent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1565,10 +1867,8 @@ serial_feature next_feature(FILE *geoms, std::atomic<long long> *geompos_in, cha
|
||||
}
|
||||
|
||||
struct run_prefilter_args {
|
||||
FILE *geoms = NULL;
|
||||
decompressor *geoms = NULL;
|
||||
std::atomic<long long> *geompos_in = NULL;
|
||||
char *metabase = NULL;
|
||||
long long *meta_off = NULL;
|
||||
int z = 0;
|
||||
unsigned tx = 0;
|
||||
unsigned ty = 0;
|
||||
@@ -1585,7 +1885,7 @@ struct run_prefilter_args {
|
||||
long long alongminus = 0;
|
||||
int buffer = 0;
|
||||
int *within = NULL;
|
||||
FILE **geomfile = NULL;
|
||||
compressor **geomfile = NULL;
|
||||
std::atomic<long long> *geompos = NULL;
|
||||
std::atomic<double> *oprogress = NULL;
|
||||
double todo = 0;
|
||||
@@ -1597,6 +1897,7 @@ struct run_prefilter_args {
|
||||
FILE *prefilter_fp = NULL;
|
||||
struct json_object *filter = NULL;
|
||||
bool first_time = false;
|
||||
bool compressed = false;
|
||||
};
|
||||
|
||||
void *run_prefilter(void *v) {
|
||||
@@ -1604,7 +1905,7 @@ void *run_prefilter(void *v) {
|
||||
json_writer state(rpa->prefilter_fp);
|
||||
|
||||
while (1) {
|
||||
serial_feature sf = next_feature(rpa->geoms, rpa->geompos_in, rpa->metabase, rpa->meta_off, rpa->z, rpa->tx, rpa->ty, rpa->initial_x, rpa->initial_y, rpa->original_features, rpa->unclipped_features, rpa->nextzoom, rpa->maxzoom, rpa->minzoom, rpa->max_zoom_increment, rpa->pass, rpa->along, rpa->alongminus, rpa->buffer, rpa->within, rpa->geomfile, rpa->geompos, rpa->oprogress, rpa->todo, rpa->fname, rpa->child_shards, rpa->filter, rpa->stringpool, rpa->pool_off, rpa->layer_unmaps, rpa->first_time);
|
||||
serial_feature sf = next_feature(rpa->geoms, rpa->geompos_in, rpa->z, rpa->tx, rpa->ty, rpa->initial_x, rpa->initial_y, rpa->original_features, rpa->unclipped_features, rpa->nextzoom, rpa->maxzoom, rpa->minzoom, rpa->max_zoom_increment, rpa->pass, rpa->along, rpa->alongminus, rpa->buffer, rpa->within, rpa->geomfile, rpa->geompos, rpa->oprogress, rpa->todo, rpa->fname, rpa->child_shards, rpa->filter, rpa->stringpool, rpa->pool_off, rpa->layer_unmaps, rpa->first_time, rpa->compressed);
|
||||
if (sf.t < 0) {
|
||||
break;
|
||||
}
|
||||
@@ -1854,7 +2155,7 @@ void add_sample_to(std::vector<T> &vals, T val, size_t &increment, size_t seq) {
|
||||
}
|
||||
}
|
||||
|
||||
long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *metabase, char *stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, FILE **geomfile, int minzoom, int maxzoom, double todo, std::atomic<long long> *along, long long alongminus, double gamma, int child_shards, long long *meta_off, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic<int> *running, double simplification, std::vector<std::map<std::string, layermap_entry>> *layermaps, std::vector<std::vector<std::string>> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, double fraction, const char *prefilter, const char *postfilter, struct json_object *filter, write_tile_args *arg, atomic_strategy *strategy) {
|
||||
long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, char *stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, int minzoom, int maxzoom, double todo, std::atomic<long long> *along, long long alongminus, double gamma, int child_shards, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic<int> *running, double simplification, std::vector<std::map<std::string, layermap_entry>> *layermaps, std::vector<std::vector<std::string>> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, double fraction, const char *prefilter, const char *postfilter, struct json_object *filter, write_tile_args *arg, atomic_strategy *strategy, bool compressed_input) {
|
||||
double merge_fraction = 1;
|
||||
double mingap_fraction = 1;
|
||||
double minextent_fraction = 1;
|
||||
@@ -1926,11 +2227,22 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
}
|
||||
|
||||
if (*geompos_in != og) {
|
||||
if (fseek(geoms, og, SEEK_SET) != 0) {
|
||||
if (compressed_input) {
|
||||
if (geoms->within) {
|
||||
geoms->end(geompos_in);
|
||||
}
|
||||
|
||||
geoms->begin();
|
||||
}
|
||||
|
||||
if (fseek(geoms->fp, og, SEEK_SET) != 0) {
|
||||
perror("fseek geom");
|
||||
exit(EXIT_SEEK);
|
||||
}
|
||||
|
||||
*geompos_in = og;
|
||||
geoms->zs.avail_in = 0;
|
||||
geoms->zs.avail_out = 0;
|
||||
}
|
||||
|
||||
int prefilter_write = -1, prefilter_read = -1;
|
||||
@@ -1958,8 +2270,6 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
|
||||
rpa.geoms = geoms;
|
||||
rpa.geompos_in = geompos_in;
|
||||
rpa.metabase = metabase;
|
||||
rpa.meta_off = meta_off;
|
||||
rpa.z = z;
|
||||
rpa.tx = tx;
|
||||
rpa.ty = ty;
|
||||
@@ -1988,6 +2298,7 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
rpa.pool_off = pool_off;
|
||||
rpa.filter = filter;
|
||||
rpa.first_time = first_time;
|
||||
rpa.compressed = compressed_input;
|
||||
|
||||
if (pthread_create(&prefilter_writer, NULL, run_prefilter, &rpa) != 0) {
|
||||
perror("pthread_create (prefilter writer)");
|
||||
@@ -2007,7 +2318,7 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
ssize_t which_partial = -1;
|
||||
|
||||
if (prefilter == NULL) {
|
||||
sf = next_feature(geoms, geompos_in, metabase, meta_off, z, tx, ty, initial_x, initial_y, &original_features, &unclipped_features, nextzoom, maxzoom, minzoom, max_zoom_increment, pass, along, alongminus, buffer, within, geomfile, geompos, &oprogress, todo, fname, child_shards, filter, stringpool, pool_off, layer_unmaps, first_time);
|
||||
sf = next_feature(geoms, geompos_in, z, tx, ty, initial_x, initial_y, &original_features, &unclipped_features, nextzoom, maxzoom, minzoom, max_zoom_increment, pass, along, alongminus, buffer, within, geomfile, geompos, &oprogress, todo, fname, child_shards, filter, stringpool, pool_off, layer_unmaps, first_time, compressed_input);
|
||||
} else {
|
||||
sf = parse_feature(prefilter_jp, z, tx, ty, layermaps, tiling_seg, layer_unmaps, postfilter != NULL);
|
||||
}
|
||||
@@ -2100,7 +2411,9 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
}
|
||||
} else if (additional[A_DROP_SMALLEST_AS_NEEDED]) {
|
||||
add_sample_to(extents, sf.extent, extents_increment, seq);
|
||||
if (sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, minextent)) {
|
||||
// search here is for LLONG_MAX, not minextent, because we are dropping features, not coalescing them,
|
||||
// so we shouldn't expect to find anything small that we can related this feature to.
|
||||
if (sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
|
||||
preserve_attributes(arg->attribute_accum, sf, stringpool, pool_off, partials[which_partial]);
|
||||
strategy->dropped_as_needed++;
|
||||
continue;
|
||||
@@ -2412,7 +2725,8 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
int j;
|
||||
for (j = 0; j < child_shards; j++) {
|
||||
if (within[j]) {
|
||||
serialize_byte(geomfile[j], -2, &geompos[j], fname);
|
||||
geomfile[j]->serialize_long_long(0, &geompos[j], fname); // EOF
|
||||
geomfile[j]->end(&geompos[j], fname);
|
||||
within[j] = 0;
|
||||
}
|
||||
}
|
||||
@@ -2575,6 +2889,7 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
if (progress >= oprogress + 0.1) {
|
||||
if (!quiet && !quiet_progress && progress_time()) {
|
||||
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
|
||||
fflush(stderr);
|
||||
}
|
||||
if (logger.json_enabled && progress_time()) {
|
||||
logger.progress_tile(progress);
|
||||
@@ -2670,7 +2985,7 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
std::string pbf = tile.encode();
|
||||
|
||||
if (!prevent[P_TILE_COMPRESSION]) {
|
||||
compress(pbf, compressed);
|
||||
compress(pbf, compressed, true);
|
||||
} else {
|
||||
compressed = pbf;
|
||||
}
|
||||
@@ -2816,7 +3131,15 @@ void *run_thread(void *vargs) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// printf("%lld of geom_size\n", (long long) geom_size[j]);
|
||||
// If this is zoom level 0, the geomfd will be uncompressed data,
|
||||
// because (at least for now) it needs to stay uncompressed during
|
||||
// the sort and post-sort maxzoom calculation and fixup so that
|
||||
// the sort can rearrange individual features and the fixup can
|
||||
// then adjust their minzooms without decompressing and recompressing
|
||||
// each feature.
|
||||
//
|
||||
// In higher zooms, it will be compressed data written out during the
|
||||
// previous zoom.
|
||||
|
||||
FILE *geom = fdopen(arg->geomfd[j], "rb");
|
||||
if (geom == NULL) {
|
||||
@@ -2824,6 +3147,8 @@ void *run_thread(void *vargs) {
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
decompressor dc(geom);
|
||||
|
||||
std::atomic<long long> geompos(0);
|
||||
long long prevgeom = 0;
|
||||
|
||||
@@ -2831,17 +3156,31 @@ void *run_thread(void *vargs) {
|
||||
int z;
|
||||
unsigned x, y;
|
||||
|
||||
if (!deserialize_int_io(geom, &z, &geompos)) {
|
||||
// These z/x/y are uncompressed so we can seek to the start of the
|
||||
// compressed feature data that immediately follows.
|
||||
|
||||
if (!dc.deserialize_int(&z, &geompos)) {
|
||||
break;
|
||||
}
|
||||
deserialize_uint_io(geom, &x, &geompos);
|
||||
deserialize_uint_io(geom, &y, &geompos);
|
||||
dc.deserialize_uint(&x, &geompos);
|
||||
dc.deserialize_uint(&y, &geompos);
|
||||
#if 0
|
||||
// currently broken because also requires tracking nextzoom when skipping zooms
|
||||
if (z != arg->zoom) {
|
||||
fprintf(stderr, "Expected zoom %d, found zoom %d\n", arg->zoom, z);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (arg->compressed) {
|
||||
dc.begin();
|
||||
}
|
||||
|
||||
arg->wrote_zoom = z;
|
||||
|
||||
// fprintf(stderr, "%d/%u/%u\n", z, x, y);
|
||||
|
||||
long long len = write_tile(geom, &geompos, arg->metabase, arg->stringpool, z, x, y, z == arg->maxzoom ? arg->full_detail : arg->low_detail, arg->min_detail, arg->outdb, arg->outdir, arg->buffer, arg->fname, arg->geomfile, arg->minzoom, arg->maxzoom, arg->todo, arg->along, geompos, arg->gamma, arg->child_shards, arg->meta_off, arg->pool_off, arg->initial_x, arg->initial_y, arg->running, arg->simplification, arg->layermaps, arg->layer_unmaps, arg->tiling_seg, arg->pass, arg->mingap, arg->minextent, arg->fraction, arg->prefilter, arg->postfilter, arg->filter, arg, arg->strategy);
|
||||
long long len = write_tile(&dc, &geompos, arg->stringpool, z, x, y, z == arg->maxzoom ? arg->full_detail : arg->low_detail, arg->min_detail, arg->outdb, arg->outdir, arg->buffer, arg->fname, arg->geomfile, arg->minzoom, arg->maxzoom, arg->todo, arg->along, geompos, arg->gamma, arg->child_shards, arg->pool_off, arg->initial_x, arg->initial_y, arg->running, arg->simplification, arg->layermaps, arg->layer_unmaps, arg->tiling_seg, arg->pass, arg->mingap, arg->minextent, arg->fraction, arg->prefilter, arg->postfilter, arg->filter, arg, arg->strategy, arg->compressed);
|
||||
|
||||
if (len < 0) {
|
||||
int *err = &arg->err;
|
||||
@@ -2906,7 +3245,7 @@ void *run_thread(void *vargs) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *meta_off, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry>> &layermaps, const char *prefilter, const char *postfilter, std::map<std::string, attribute_op> const *attribute_accum, struct json_object *filter, std::vector<strategy> &strategies) {
|
||||
int traverse_zooms(int *geomfd, off_t *geom_size, char *stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry>> &layermaps, const char *prefilter, const char *postfilter, std::map<std::string, attribute_op> const *attribute_accum, struct json_object *filter, std::vector<strategy> &strategies, int iz) {
|
||||
last_progress = 0;
|
||||
|
||||
// The existing layermaps are one table per input thread.
|
||||
@@ -2931,10 +3270,11 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
}
|
||||
|
||||
int z;
|
||||
for (z = 0; z <= maxzoom; z++) {
|
||||
for (z = iz; z <= maxzoom; z++) {
|
||||
std::atomic<long long> most(0);
|
||||
|
||||
FILE *sub[TEMP_FILES];
|
||||
compressor compressors[TEMP_FILES];
|
||||
compressor *sub[TEMP_FILES];
|
||||
int subfd[TEMP_FILES];
|
||||
for (size_t j = 0; j < TEMP_FILES; j++) {
|
||||
char geomname[strlen(tmpdir) + strlen("/geom.XXXXXXXX" XSTRINGIFY(INT_MAX)) + 1];
|
||||
@@ -2945,12 +3285,14 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
perror(geomname);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
sub[j] = fopen_oflag(geomname, "wb", O_WRONLY | O_CLOEXEC);
|
||||
if (sub[j] == NULL) {
|
||||
FILE *fp = fopen_oflag(geomname, "wb", O_WRONLY | O_CLOEXEC);
|
||||
if (fp == NULL) {
|
||||
perror(geomname);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
unlink(geomname);
|
||||
compressors[j] = compressor(fp);
|
||||
sub[j] = &compressors[j];
|
||||
// unlink(geomname);
|
||||
}
|
||||
|
||||
size_t useful_threads = 0;
|
||||
@@ -2961,6 +3303,11 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
useful_threads++;
|
||||
}
|
||||
}
|
||||
if (z == iz + 1) {
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "(compressed geometry size %lld for zoom level %d)\n", todo, z);
|
||||
}
|
||||
}
|
||||
|
||||
size_t threads = CPUS;
|
||||
if (threads > TEMP_FILES / 4) {
|
||||
@@ -2968,7 +3315,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
}
|
||||
// XXX is it useful to divide further if we know we are skipping
|
||||
// some zoom levels? Is it faster to have fewer CPUs working on
|
||||
// sharding, but more deeply, or fewer CPUs, less deeply?
|
||||
// sharding, but more deeply, or more CPUs, less deeply?
|
||||
if (threads > useful_threads) {
|
||||
threads = useful_threads;
|
||||
}
|
||||
@@ -3053,7 +3400,6 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
atomic_strategy strategy;
|
||||
|
||||
for (size_t thread = 0; thread < threads; thread++) {
|
||||
args[thread].metabase = metabase;
|
||||
args[thread].stringpool = stringpool;
|
||||
args[thread].min_detail = min_detail;
|
||||
args[thread].outdb = outdb; // locked with db_lock
|
||||
@@ -3090,7 +3436,6 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
args[thread].full_detail = full_detail;
|
||||
args[thread].low_detail = low_detail;
|
||||
args[thread].most = &most; // locked with var_lock
|
||||
args[thread].meta_off = meta_off;
|
||||
args[thread].pool_off = pool_off;
|
||||
args[thread].initial_x = initial_x;
|
||||
args[thread].initial_y = initial_y;
|
||||
@@ -3108,6 +3453,8 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
args[thread].wrote_zoom = -1;
|
||||
args[thread].still_dropping = false;
|
||||
args[thread].strategy = &strategy;
|
||||
args[thread].zoom = z;
|
||||
args[thread].compressed = (z != iz);
|
||||
|
||||
if (pthread_create(&pthreads[thread], NULL, run_thread, &args[thread]) != 0) {
|
||||
perror("pthread_create");
|
||||
@@ -3186,7 +3533,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
}
|
||||
if (fclose(sub[j]) != 0) {
|
||||
if (sub[j]->fclose() != 0) {
|
||||
perror("close subfile");
|
||||
exit(EXIT_CLOSE);
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ struct strategy {
|
||||
strategy() = default;
|
||||
};
|
||||
|
||||
long long write_tile(char **geom, char *metabase, char *stringpool, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int min_detail, int basezoom, sqlite3 *outdb, const char *outdir, double droprate, int buffer, const char *fname, FILE **geomfile, int file_minzoom, int file_maxzoom, double todo, char *geomstart, long long along, double gamma, int nlayers, std::atomic<strategy> *strategy);
|
||||
long long write_tile(char **geom, char *stringpool, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int min_detail, int basezoom, sqlite3 *outdb, const char *outdir, double droprate, int buffer, const char *fname, FILE **geomfile, int file_minzoom, int file_maxzoom, double todo, char *geomstart, long long along, double gamma, int nlayers, std::atomic<strategy> *strategy);
|
||||
|
||||
int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *meta_off, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry> > &layermap, const char *prefilter, const char *postfilter, std::map<std::string, attribute_op> const *attribute_accum, struct json_object *filter, std::vector<strategy> &strategies);
|
||||
int traverse_zooms(int *geomfd, off_t *geom_size, char *stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry> > &layermap, const char *prefilter, const char *postfilter, std::map<std::string, attribute_op> const *attribute_accum, struct json_object *filter, std::vector<strategy> &strategies, int iz);
|
||||
|
||||
int manage_gap(unsigned long long index, unsigned long long *previndex, double scale, double gamma, double *gap);
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v2.21.0"
|
||||
#define VERSION "v2.22.0"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user