Merge branch 'master' into plugins

This commit is contained in:
Eric Fischer
2017-01-25 16:38:03 -08:00
7 changed files with 29 additions and 535 deletions
+17 -3
View File
@@ -17,6 +17,9 @@
#include "geometry.hpp"
#include "write_json.hpp"
int minzoom = 0;
int maxzoom = 32;
void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
int within = 0;
mvt_tile tile;
@@ -142,13 +145,16 @@ void decode(char *fname, int z, unsigned x, unsigned y) {
sqlite3_finalize(stmt2);
const char *sql = "SELECT tile_data, zoom_level, tile_column, tile_row from tiles order by zoom_level, tile_column, tile_row;";
const char *sql = "SELECT tile_data, zoom_level, tile_column, tile_row from tiles where zoom_level between ? and ? order by zoom_level, tile_column, tile_row;";
sqlite3_stmt *stmt;
if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
fprintf(stderr, "%s: select failed: %s\n", fname, sqlite3_errmsg(db));
exit(EXIT_FAILURE);
}
sqlite3_bind_int(stmt, 1, minzoom);
sqlite3_bind_int(stmt, 2, maxzoom);
printf("\n}, \"features\": [\n");
within = 0;
@@ -212,7 +218,7 @@ void decode(char *fname, int z, unsigned x, unsigned y) {
}
void usage(char **argv) {
fprintf(stderr, "Usage: %s [-t projection] file.mbtiles zoom x y\n", argv[0]);
fprintf(stderr, "Usage: %s [-t projection] [-Z minzoom] [-z maxzoom] file.mbtiles [zoom x y]\n", argv[0]);
exit(EXIT_FAILURE);
}
@@ -221,12 +227,20 @@ int main(int argc, char **argv) {
extern char *optarg;
int i;
while ((i = getopt(argc, argv, "t:")) != -1) {
while ((i = getopt(argc, argv, "t:Z:z:")) != -1) {
switch (i) {
case 't':
set_projection_or_exit(optarg);
break;
case 'z':
maxzoom = atoi(optarg);
break;
case 'Z':
minzoom = atoi(optarg);
break;
default:
usage(argv);
}