Write out the JSON part of the metadata

This commit is contained in:
Eric Fischer 2015-08-20 15:01:34 -07:00
parent ed378681e4
commit 2e3f03172e
2 changed files with 12 additions and 4 deletions

View File

@ -33,7 +33,7 @@ enumerate: enumerate.o
decode: decode.o vector_tile.pb.o projection.o
g++ $(PG) $(LIBS) -O3 -g -Wall -o $@ $^ -lm -lz -lprotobuf-lite -lsqlite3
tile-join: tile-join.o vector_tile.pb.o projection.o pool.o
tile-join: tile-join.o vector_tile.pb.o projection.o pool.o mbtiles.o
g++ $(PG) $(LIBS) -O3 -g -Wall -o $@ $^ -lm -lz -lprotobuf-lite -lsqlite3
libjsonpull.a: jsonpull.o

View File

@ -14,6 +14,7 @@
extern "C" {
#include "projection.h"
#include "pool.h"
#include "mbtiles.h"
}
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
@ -170,8 +171,6 @@ void handle(std::string message, int z, unsigned x, unsigned y, struct pool **fi
outfeature->add_tags(k->n);
outfeature->add_tags(v->n);
printf("%d: %s=%s %d=%d\n", type, key, value, k->n, v->n);
free(value);
}
}
@ -205,7 +204,7 @@ void decode(char *fname, char *map, struct pool **file_keys, char ***layernames,
int len = sqlite3_column_bytes(stmt, 3);
const char *s = (const char *) sqlite3_column_blob(stmt, 3);
printf("found %lld/%lld/%lld\n", zoom, x, y);
printf("%lld/%lld/%lld \r", zoom, x, y);
handle(std::string(s, len), zoom, x, y, file_keys, layernames, nlayers);
}
@ -250,6 +249,12 @@ int main(int argc, char **argv) {
usage(argv);
}
if (force) {
unlink(outfile);
}
sqlite3 *outdb = mbtiles_open(outfile, argv);
struct pool *file_keys = NULL;
char **layernames = NULL;
int nlayers = 0;
@ -260,5 +265,8 @@ int main(int argc, char **argv) {
printf("%s\n", layernames[i]);
}
mbtiles_write_metadata(outdb, outfile, layernames, 0, 0, 0, 0, 0, 0, 0, 0, &file_keys, nlayers);
mbtiles_close(outdb, argv);
return 0;
}