Move the tilestats into the "json" row of the metadata

This commit is contained in:
Eric Fischer
2017-07-26 09:54:49 -07:00
parent 5a09fcc35e
commit cc28bbab3a
80 changed files with 83 additions and 169 deletions
+4 -11
View File
@@ -453,14 +453,16 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *outdir, const char *fnam
} else if (type == (1 << mvt_string)) {
aprintf(&buf, "\": \"String\"");
} else {
aprintf(&buf, "\": \"Composite\""); // XXX tilestats: composite?
aprintf(&buf, "\": \"Mixed\"");
}
}
aprintf(&buf, "} }");
}
aprintf(&buf, " ] }");
aprintf(&buf, " ],");
aprintf(&buf, "\"tilestats\": %s", tilestats(layermap).c_str());
aprintf(&buf, "}");
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('json', %Q);", buf.c_str());
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
@@ -470,15 +472,6 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *outdir, const char *fnam
}
}
sqlite3_free(sql);
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('tilestats', %Q);", tilestats(layermap).c_str());
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
fprintf(stderr, "set tilestats: %s\n", err);
if (!forcetable) {
exit(EXIT_FAILURE);
}
}
sqlite3_free(sql);
}
if (outdir != NULL) {