mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Merge branch 'master' into raw-tiles-zoom-enumerate
This commit is contained in:
+26
-3
@@ -29,6 +29,7 @@
|
||||
#include "dirtiles.hpp"
|
||||
#include "evaluator.hpp"
|
||||
#include "csv.hpp"
|
||||
#include "text.hpp"
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
@@ -619,7 +620,7 @@ void handle_vector_layers(json_object *vector_layers, std::map<std::string, laye
|
||||
}
|
||||
}
|
||||
|
||||
void decode(struct reader *readers, std::map<std::string, layermap_entry> &layermap, sqlite3 *outdb, const char *outdir, struct stats *st, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, int ifmatched, std::string &attribution, std::string &description, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, std::string &name, json_object *filter, std::map<std::string, std::string> &attribute_descriptions) {
|
||||
void decode(struct reader *readers, std::map<std::string, layermap_entry> &layermap, sqlite3 *outdb, const char *outdir, struct stats *st, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, int ifmatched, std::string &attribution, std::string &description, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, std::string &name, json_object *filter, std::map<std::string, std::string> &attribute_descriptions, std::string &generator_options) {
|
||||
std::vector<std::map<std::string, layermap_entry>> layermaps;
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
layermaps.push_back(std::map<std::string, layermap_entry>());
|
||||
@@ -824,6 +825,20 @@ void decode(struct reader *readers, std::map<std::string, layermap_entry> &layer
|
||||
|
||||
sqlite3_finalize(r->stmt);
|
||||
}
|
||||
if (sqlite3_prepare_v2(db, "SELECT value from metadata where name = 'generator_options'", -1, &r->stmt, NULL) == SQLITE_OK) {
|
||||
if (sqlite3_step(r->stmt) == SQLITE_ROW) {
|
||||
const unsigned char *s = sqlite3_column_text(r->stmt, 0);
|
||||
if (s != NULL) {
|
||||
if (generator_options.size() != 0) {
|
||||
generator_options.append("; ");
|
||||
generator_options.append((const char *) s);
|
||||
} else {
|
||||
generator_options = (const char *) s;
|
||||
}
|
||||
}
|
||||
}
|
||||
sqlite3_finalize(r->stmt);
|
||||
}
|
||||
|
||||
// Closes either real db or temp mirror of metadata.json
|
||||
if (sqlite3_close(db) != SQLITE_OK) {
|
||||
@@ -912,6 +927,8 @@ int main(int argc, char **argv) {
|
||||
extern char *optarg;
|
||||
int i;
|
||||
|
||||
std::string commandline = format_commandline(argc, argv);
|
||||
|
||||
while ((i = getopt_long(argc, argv, getopt_str.c_str(), long_options, NULL)) != -1) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
@@ -1079,8 +1096,9 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> attribute_descriptions;
|
||||
std::string generator_options;
|
||||
|
||||
decode(readers, layermap, outdb, out_dir, &st, header, mapping, exclude, ifmatched, attribution, description, keep_layers, remove_layers, name, filter, attribute_descriptions);
|
||||
decode(readers, layermap, outdb, out_dir, &st, header, mapping, exclude, ifmatched, attribution, description, keep_layers, remove_layers, name, filter, attribute_descriptions, generator_options);
|
||||
|
||||
if (set_attribution.size() != 0) {
|
||||
attribution = set_attribution;
|
||||
@@ -1092,6 +1110,11 @@ int main(int argc, char **argv) {
|
||||
name = set_name;
|
||||
}
|
||||
|
||||
if (generator_options.size() != 0) {
|
||||
generator_options.append("; ");
|
||||
}
|
||||
generator_options.append(commandline);
|
||||
|
||||
for (auto &l : layermap) {
|
||||
if (l.second.minzoom < st.minzoom) {
|
||||
st.minzoom = l.second.minzoom;
|
||||
@@ -1101,7 +1124,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
mbtiles_write_metadata(outdb, out_dir, name.c_str(), st.minzoom, st.maxzoom, st.minlat, st.minlon, st.maxlat, st.maxlon, st.midlat, st.midlon, 0, attribution.size() != 0 ? attribution.c_str() : NULL, layermap, true, description.c_str(), !pg, attribute_descriptions, "tile-join");
|
||||
mbtiles_write_metadata(outdb, out_dir, name.c_str(), st.minzoom, st.maxzoom, st.minlat, st.minlon, st.maxlat, st.maxlon, st.midlat, st.midlon, 0, attribution.size() != 0 ? attribution.c_str() : NULL, layermap, true, description.c_str(), !pg, attribute_descriptions, "tile-join", generator_options);
|
||||
|
||||
if (outdb != NULL) {
|
||||
mbtiles_close(outdb, argv[0]);
|
||||
|
||||
Reference in New Issue
Block a user