Merge branch 'master' into plugins

This commit is contained in:
Eric Fischer 2017-03-28 16:42:22 -07:00
commit 7d47226444
17 changed files with 411 additions and 87 deletions

View File

@ -1,3 +1,8 @@
## 1.16.14
* Add --description option for mbtiles metadata
* Clean up some utility functions
## 1.16.13
* Add --detect-longitude-wraparound option

View File

@ -62,6 +62,7 @@ Options
* -L _name_:_file.json_ or --named-layer=_name_:_file.json_: Specify layer names for individual files. If your shell supports it, you can use a subshell redirect like -L _name_:<(cat dir/*.json) to specify a layer name for the output of streamed input.
* -n _name_ or --name=_name_: Human-readable name for the tileset (default file.json)
* -A _text_ or --attribution=_text_: Attribution (HTML) to be shown with maps that use data from this tileset.
* -N _description_ or --description=_description_: Description for the tileset (default file.mbtiles)
### File control

View File

@ -39,6 +39,7 @@ extern "C" {
#include "serial.hpp"
#include "text.hpp"
#include "read_json.hpp"
#include "mvt.hpp"
static long long parse_geometry1(int t, json_object *j, long long *bbox, drawvec &geom, int op, const char *fname, int line, int *initialized, unsigned *initial_x, unsigned *initial_y, json_object *feature, long long &prev, long long &offset, bool &has_prev) {
parse_geometry(t, j, geom, op, fname, line, feature);
@ -359,13 +360,13 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
if (inline_meta) {
sf.metapos = -1;
for (size_t i = 0; i < m; i++) {
sf.keys.push_back(addpool(poolfile, treefile, metakey[i], VT_STRING));
sf.keys.push_back(addpool(poolfile, treefile, metakey[i], mvt_string));
sf.values.push_back(addpool(poolfile, treefile, metaval[i].c_str(), metatype[i]));
}
} else {
sf.metapos = *metapos;
for (size_t i = 0; i < m; i++) {
serialize_long_long(metafile, addpool(poolfile, treefile, metakey[i], VT_STRING), metapos, fname);
serialize_long_long(metafile, addpool(poolfile, treefile, metakey[i], mvt_string), metapos, fname);
serialize_long_long(metafile, addpool(poolfile, treefile, metaval[i].c_str(), metatype[i]), metapos, fname);
}
}

View File

@ -7,10 +7,6 @@
#define VT_LINETO 2
#define VT_CLOSEPATH 7
#define VT_STRING 1
#define VT_NUMBER 2
#define VT_BOOLEAN 7
// The bitfield is to make sizeof(draw) be 16 instead of 24
// at the cost, apparently, of a 0.7% increase in running time
// for packing and unpacking.

View File

@ -55,6 +55,7 @@ extern "C" {
#include "geometry.hpp"
#include "serial.hpp"
#include "options.hpp"
#include "mvt.hpp"
static int low_detail = 12;
static int full_detail = -1;
@ -1009,7 +1010,7 @@ void choose_first_zoom(long long *file_bbox, struct reader *reader, unsigned *iz
}
}
int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzoom, int basezoom, double basezoom_marker_width, sqlite3 *outdb, std::set<std::string> *exclude, std::set<std::string> *include, int exclude_all, double droprate, int buffer, const char *tmpdir, double gamma, int read_parallel, int forcetable, const char *attribution, bool uses_gamma, long long *file_bbox, const char *prefilter, const char *postfilter) {
int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzoom, int basezoom, double basezoom_marker_width, sqlite3 *outdb, std::set<std::string> *exclude, std::set<std::string> *include, int exclude_all, double droprate, int buffer, const char *tmpdir, double gamma, int read_parallel, int forcetable, const char *attribution, bool uses_gamma, long long *file_bbox, const char *prefilter, const char *postfilter, const char *description) {
int ret = EXIT_SUCCESS;
struct reader reader[CPUS];
@ -1842,7 +1843,7 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
if (additional[A_CALCULATE_FEATURE_DENSITY]) {
for (auto ai = merged_lm.begin(); ai != merged_lm.end(); ++ai) {
type_and_string tas;
tas.type = VT_NUMBER;
tas.type = mvt_double;
tas.string = "tippecanoe_feature_density";
ai->second.file_keys.insert(tas);
}
@ -1852,7 +1853,7 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
ai->second.minzoom = minzoom;
ai->second.maxzoom = maxzoom;
}
mbtiles_write_metadata(outdb, fname, minzoom, maxzoom, minlat, minlon, maxlat, maxlon, midlat, midlon, forcetable, attribution, merged_lm);
mbtiles_write_metadata(outdb, fname, minzoom, maxzoom, minlat, minlon, maxlat, maxlon, midlat, midlon, forcetable, attribution, merged_lm, true, description);
return ret;
}
@ -1879,6 +1880,7 @@ int main(int argc, char **argv) {
int i;
char *name = NULL;
char *description = NULL;
char *layername = NULL;
char *outdir = NULL;
int maxzoom = 14;
@ -1910,6 +1912,7 @@ int main(int argc, char **argv) {
{"output", required_argument, 0, 'o'},
{"name", required_argument, 0, 'n'},
{"description", required_argument, 0, 'N'},
{"layer", required_argument, 0, 'l'},
{"attribution", required_argument, 0, 'A'},
{"named-layer", required_argument, 0, 'L'},
@ -1988,7 +1991,7 @@ int main(int argc, char **argv) {
}
}
while ((i = getopt_long(argc, argv, "n:l:z:Z:B:d:D:m:o:x:y:r:b:t:g:p:a:XfFqvPL:A:s:S:M:c:C:", long_options, NULL)) != -1) {
while ((i = getopt_long(argc, argv, "n:l:z:Z:B:d:D:m:o:x:y:r:b:t:g:p:a:XfFqvPL:A:s:S:M:N:c:C:", long_options, NULL)) != -1) {
switch (i) {
case 0:
break;
@ -1997,6 +2000,10 @@ int main(int argc, char **argv) {
name = optarg;
break;
case 'N':
description = optarg;
break;
case 'l':
layername = optarg;
break;
@ -2296,7 +2303,7 @@ int main(int argc, char **argv) {
long long file_bbox[4] = {UINT_MAX, UINT_MAX, 0, 0};
ret = read_input(sources, name ? name : outdir, maxzoom, minzoom, basezoom, basezoom_marker_width, outdb, &exclude, &include, exclude_all, droprate, buffer, tmpdir, gamma, read_parallel, forcetable, attribution, gamma != 0, file_bbox, prefilter, postfilter);
ret = read_input(sources, name ? name : outdir, maxzoom, minzoom, basezoom, basezoom_marker_width, outdb, &exclude, &include, exclude_all, droprate, buffer, tmpdir, gamma, read_parallel, forcetable, attribution, gamma != 0, file_bbox, prefilter, postfilter, description);
mbtiles_close(outdb, argv);

View File

@ -11,10 +11,8 @@
#include <string>
#include <set>
#include <map>
#include "main.hpp"
#include "pool.hpp"
#include "mvt.hpp"
#include "mbtiles.hpp"
#include "geometry.hpp"
sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable) {
sqlite3 *outdb;
@ -128,7 +126,7 @@ bool type_and_string::operator<(const type_and_string &o) const {
return false;
}
void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double midlat, double midlon, int forcetable, const char *attribution, std::map<std::string, layermap_entry> const &layermap) {
void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double midlat, double midlon, int forcetable, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description) {
char *sql, *err;
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('name', %Q);", fname);
@ -140,7 +138,7 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, int minzoom, int
}
sqlite3_free(sql);
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('description', %Q);", fname);
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('description', %Q);", description != NULL ? description : fname);
if (sqlite3_exec(outdb, sql, NULL, NULL, &err) != SQLITE_OK) {
fprintf(stderr, "set description in metadata: %s\n", err);
if (!forcetable) {
@ -214,7 +212,7 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, int minzoom, int
sqlite3_free(sql);
}
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('format', %Q);", "pbf");
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('format', %Q);", vector ? "pbf" : "png");
if (sqlite3_exec(outdb, sql, NULL, NULL, &err) != SQLITE_OK) {
fprintf(stderr, "set format: %s\n", err);
if (!forcetable) {
@ -223,58 +221,64 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, int minzoom, int
}
sqlite3_free(sql);
std::string buf("{");
aprintf(&buf, "\"vector_layers\": [ ");
if (vector) {
std::string buf("{");
aprintf(&buf, "\"vector_layers\": [ ");
std::vector<std::string> lnames;
for (auto ai = layermap.begin(); ai != layermap.end(); ++ai) {
lnames.push_back(ai->first);
}
for (size_t i = 0; i < lnames.size(); i++) {
if (i != 0) {
aprintf(&buf, ", ");
std::vector<std::string> lnames;
for (auto ai = layermap.begin(); ai != layermap.end(); ++ai) {
lnames.push_back(ai->first);
}
auto fk = layermap.find(lnames[i]);
aprintf(&buf, "{ \"id\": \"");
quote(buf, lnames[i]);
aprintf(&buf, "\", \"description\": \"\", \"minzoom\": %d, \"maxzoom\": %d, \"fields\": {", fk->second.minzoom, fk->second.maxzoom);
std::set<type_and_string>::iterator j;
bool first = true;
for (j = fk->second.file_keys.begin(); j != fk->second.file_keys.end(); ++j) {
if (first) {
first = false;
} else {
for (size_t i = 0; i < lnames.size(); i++) {
if (i != 0) {
aprintf(&buf, ", ");
}
aprintf(&buf, "\"");
quote(buf, j->string);
auto fk = layermap.find(lnames[i]);
aprintf(&buf, "{ \"id\": \"");
quote(buf, lnames[i]);
aprintf(&buf, "\", \"description\": \"\", \"minzoom\": %d, \"maxzoom\": %d, \"fields\": {", fk->second.minzoom, fk->second.maxzoom);
if (j->type == VT_NUMBER) {
aprintf(&buf, "\": \"Number\"");
} else if (j->type == VT_BOOLEAN) {
aprintf(&buf, "\": \"Boolean\"");
} else {
aprintf(&buf, "\": \"String\"");
std::set<type_and_string>::iterator j;
bool first = true;
for (j = fk->second.file_keys.begin(); j != fk->second.file_keys.end(); ++j) {
if (first) {
first = false;
} else {
aprintf(&buf, ", ");
}
aprintf(&buf, "\"");
quote(buf, j->string);
if (j->type == mvt_double ||
j->type == mvt_float ||
j->type == mvt_double ||
j->type == mvt_uint ||
j->type == mvt_sint) {
aprintf(&buf, "\": \"Number\"");
} else if (j->type == mvt_bool) {
aprintf(&buf, "\": \"Boolean\"");
} else {
aprintf(&buf, "\": \"String\"");
}
}
aprintf(&buf, "} }");
}
aprintf(&buf, " ] }");
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('json', %Q);", buf.c_str());
if (sqlite3_exec(outdb, sql, NULL, NULL, &err) != SQLITE_OK) {
fprintf(stderr, "set json: %s\n", err);
if (!forcetable) {
exit(EXIT_FAILURE);
}
}
aprintf(&buf, "} }");
sqlite3_free(sql);
}
aprintf(&buf, " ] }");
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('json', %Q);", buf.c_str());
if (sqlite3_exec(outdb, sql, NULL, NULL, &err) != SQLITE_OK) {
fprintf(stderr, "set json: %s\n", err);
if (!forcetable) {
exit(EXIT_FAILURE);
}
}
sqlite3_free(sql);
}
void mbtiles_close(sqlite3 *outdb, char **argv) {

View File

@ -20,7 +20,7 @@ sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable);
void mbtiles_write_tile(sqlite3 *outdb, int z, int tx, int ty, const char *data, int size);
void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double midlat, double midlon, int forcetable, const char *attribution, std::map<std::string, layermap_entry> const &layermap);
void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double midlat, double midlon, int forcetable, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description);
void mbtiles_close(sqlite3 *outdb, char **argv);

View File

@ -455,7 +455,7 @@ static int is_integer(const char *s, long long *v) {
mvt_value stringified_to_mvt_value(int type, const char *s) {
mvt_value tv;
if (type == VT_NUMBER) {
if (type == mvt_double) {
long long v;
if (is_integer(s, &v)) {
if (v >= 0) {
@ -476,7 +476,7 @@ mvt_value stringified_to_mvt_value(int type, const char *s) {
tv.numeric_value.double_value = d;
}
}
} else if (type == VT_BOOLEAN) {
} else if (type == mvt_bool) {
tv.type = mvt_bool;
tv.numeric_value.bool_value = (s[0] == 't');
} else {

12
mvt.hpp
View File

@ -13,6 +13,18 @@ struct mvt_geometry {
int /* mvt_operation */ op;
mvt_geometry(int op, long long x, long long y);
bool operator<(mvt_geometry const &s) const {
if (y < s.y || (y == s.y && x < s.x)) {
return true;
} else {
return false;
}
}
bool operator==(mvt_geometry const &s) const {
return y == s.y && x == s.x;
}
};
enum mvt_geometry_type {

View File

@ -83,13 +83,32 @@ unsigned long long encode(unsigned int wx, unsigned int wy) {
return out;
}
static unsigned char decodex[256];
static unsigned char decodey[256];
void decode(unsigned long long index, unsigned *wx, unsigned *wy) {
static int initialized = 0;
if (!initialized) {
for (size_t ix = 0; ix < 256; ix++) {
size_t xx = 0, yy = 0;
for (size_t i = 0; i < 32; i++) {
xx |= ((ix >> (64 - 2 * (i + 1) + 1)) & 1) << (32 - (i + 1));
yy |= ((ix >> (64 - 2 * (i + 1) + 0)) & 1) << (32 - (i + 1));
}
decodex[ix] = xx;
decodey[ix] = yy;
}
initialized = 1;
}
*wx = *wy = 0;
int i;
for (i = 0; i < 32; i++) {
*wx |= ((index >> (64 - 2 * (i + 1) + 1)) & 1) << (32 - (i + 1));
*wy |= ((index >> (64 - 2 * (i + 1) + 0)) & 1) << (32 - (i + 1));
for (size_t i = 0; i < 8; i++) {
*wx |= ((unsigned) decodex[(index >> (8 * i)) & 0xFF]) << (4 * i);
*wy |= ((unsigned) decodey[(index >> (8 * i)) & 0xFF]) << (4 * i);
}
}

View File

@ -3,6 +3,7 @@
#include <string.h>
#include <vector>
#include <string>
#include <map>
extern "C" {
#include "jsonpull/jsonpull.h"
@ -12,6 +13,7 @@ extern "C" {
#include "projection.hpp"
#include "read_json.hpp"
#include "text.hpp"
#include "mvt.hpp"
const char *geometry_names[GEOM_TYPES] = {
"Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon",
@ -105,7 +107,7 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
void stringify_value(json_object *value, int &type, std::string &stringified, const char *reading, int line, json_object *feature) {
if (value != NULL && value->type == JSON_STRING) {
type = VT_STRING;
type = mvt_string;
stringified = std::string(value->string);
std::string err = check_utf8(stringified);
if (err != "") {
@ -114,15 +116,15 @@ void stringify_value(json_object *value, int &type, std::string &stringified, co
exit(EXIT_FAILURE);
}
} else if (value != NULL && value->type == JSON_NUMBER) {
type = VT_NUMBER;
type = mvt_double;
stringified = std::string(value->string);
} else if (value != NULL && (value->type == JSON_TRUE || value->type == JSON_FALSE)) {
type = VT_BOOLEAN;
type = mvt_bool;
stringified = std::string(value->type == JSON_TRUE ? "true" : "false");
} else if (value != NULL && (value->type == JSON_NULL)) {
;
} else {
type = VT_STRING;
type = mvt_string;
const char *v = json_stringify(value);
stringified = std::string(v);
free((void *) v); // stringify

View File

@ -1,7 +1,7 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-122.334735,37.877356,-122.281639,37.898925",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/joined-i.mbtiles",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
"json": "{\"vector_layers\": [ { \"id\": \"tabblock_06001420\", \"description\": \"\", \"minzoom\": 3, \"maxzoom\": 12, \"fields\": {\"ALAND10\": \"Number\", \"AWATER10\": \"Number\", \"BLOCKCE10\": \"String\", \"COUNTYFP10\": \"String\", \"FUNCSTAT10\": \"String\", \"INTPTLAT10\": \"String\", \"INTPTLON10\": \"String\", \"MTFCC10\": \"String\", \"NAME10\": \"String\", \"STATEFP10\": \"String\", \"TRACTCE10\": \"String\", \"UACE10\": \"String\", \"UATYP10\": \"String\", \"UR10\": \"String\", \"population\": \"Number\"} } ] }",
"maxzoom": "12",

View File

@ -1,7 +1,7 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-122.334735,37.877356,-122.281639,37.898925",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/joined.mbtiles",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
"json": "{\"vector_layers\": [ { \"id\": \"tabblock_06001420\", \"description\": \"\", \"minzoom\": 3, \"maxzoom\": 12, \"fields\": {\"ALAND10\": \"Number\", \"AWATER10\": \"Number\", \"BLOCKCE10\": \"String\", \"COUNTYFP10\": \"String\", \"FUNCSTAT10\": \"String\", \"INTPTLAT10\": \"String\", \"INTPTLON10\": \"String\", \"MTFCC10\": \"String\", \"NAME10\": \"String\", \"STATEFP10\": \"String\", \"TRACTCE10\": \"String\", \"UACE10\": \"String\", \"UATYP10\": \"String\", \"UR10\": \"String\", \"population\": \"Number\"} } ] }",
"maxzoom": "12",

View File

@ -1,7 +1,7 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-122.334735,37.695438,-122.104097,37.898925",
"center": "-122.299805,37.892187,12",
"description": "tests/join-population/merged.mbtiles",
"description": "tests/join-population/tabblock_06001420.mbtiles",
"format": "pbf",
"json": "{\"vector_layers\": [ { \"id\": \"macarthur\", \"description\": \"\", \"minzoom\": 5, \"maxzoom\": 11, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} }, { \"id\": \"tabblock_06001420\", \"description\": \"\", \"minzoom\": 3, \"maxzoom\": 12, \"fields\": {\"ALAND10\": \"Number\", \"AWATER10\": \"Number\", \"BLOCKCE10\": \"String\", \"COUNTYFP10\": \"String\", \"FUNCSTAT10\": \"String\", \"GEOID10\": \"String\", \"INTPTLAT10\": \"String\", \"INTPTLON10\": \"String\", \"MTFCC10\": \"String\", \"NAME10\": \"String\", \"STATEFP10\": \"String\", \"TRACTCE10\": \"String\", \"UACE10\": \"String\", \"UATYP10\": \"String\", \"UR10\": \"String\"} } ] }",
"maxzoom": "12",

View File

@ -1,7 +1,7 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-122.294563,37.695438,-122.104097,37.833010",
"center": "-122.167969,37.833010,10",
"description": "tests/join-population/windows.mbtiles",
"description": "tests/join-population/macarthur.mbtiles",
"format": "pbf",
"json": "{\"vector_layers\": [ { \"id\": \"macarthur\", \"description\": \"\", \"minzoom\": 5, \"maxzoom\": 10, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ] }",
"maxzoom": "10",

View File

@ -0,0 +1,270 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-1.000000,-1.000000,1.000000,1.000000",
"center": "-1.000000,1.000000,4",
"description": "NullIsland",
"format": "pbf",
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 4, \"fields\": {} } ] }",
"maxzoom": "4",
"minzoom": "0",
"name": "tests/nullisland/out/-b0_-z4_-NNullIsland.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 1.054628 ], [ 0.000000, 0.000000 ], [ -1.054688, 0.000000 ], [ -1.054688, 1.054628 ], [ 0.000000, 1.054628 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -1.054688, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ -1.054688, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 0.000000 ], [ 0.000000, -0.966751 ], [ -1.054688, -0.966751 ], [ -1.054688, 0.000000 ], [ 0.000000, 0.000000 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, 1.054628 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.966797, 1.054628 ], [ 0.966797, 0.000000 ], [ 0.000000, 0.000000 ], [ 0.000000, 1.054628 ], [ 0.966797, 1.054628 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, -0.966751 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.966797, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.966797, 0.000000 ], [ 0.966797, -0.966751 ], [ 0.000000, -0.966751 ], [ 0.000000, 0.000000 ], [ 0.966797, 0.000000 ] ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 0, "y": 1 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -1.010742, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ -1.010742, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 0.000000 ], [ 0.000000, -0.966751 ], [ -1.010742, -0.966751 ], [ -1.010742, 0.000000 ], [ 0.000000, 0.000000 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, -0.966751 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 0, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 1.010690 ], [ 0.000000, 0.000000 ], [ -1.010742, 0.000000 ], [ -1.010742, 1.010690 ], [ 0.000000, 1.010690 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -1.010742, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ -1.010742, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 1.010690 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, 1.010690 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 1, "y": 1 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, -0.966751 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.966797, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.966797, 0.000000 ], [ 0.966797, -0.966751 ], [ 0.000000, -0.966751 ], [ 0.000000, 0.000000 ], [ 0.966797, 0.000000 ] ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 1, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 1.010690 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, 1.010690 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.966797, 1.010690 ], [ 0.966797, 0.000000 ], [ 0.000000, 0.000000 ], [ 0.000000, 1.010690 ], [ 0.966797, 1.010690 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.966797, 0.000000 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 2, "x": 1, "y": 2 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -1.010742, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ -1.010742, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 0.000000 ], [ 0.000000, -0.988720 ], [ -1.010742, -0.988720 ], [ -1.010742, 0.000000 ], [ 0.000000, 0.000000 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, -0.988720 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 2, "x": 1, "y": 1 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 1.010690 ], [ 0.000000, 0.000000 ], [ -1.010742, 0.000000 ], [ -1.010742, 1.010690 ], [ 0.000000, 1.010690 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -1.010742, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ -1.010742, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 1.010690 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, 1.010690 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 2, "x": 2, "y": 2 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, -0.988720 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.988770, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.988770, 0.000000 ], [ 0.988770, -0.988720 ], [ 0.000000, -0.988720 ], [ 0.000000, 0.000000 ], [ 0.988770, 0.000000 ] ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 2, "x": 2, "y": 1 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 1.010690 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, 1.010690 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.988770, 1.010690 ], [ 0.988770, 0.000000 ], [ 0.000000, 0.000000 ], [ 0.000000, 1.010690 ], [ 0.988770, 1.010690 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.988770, 0.000000 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 3, "x": 3, "y": 4 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -1.010742, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ -1.010742, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 0.000000 ], [ 0.000000, -0.999705 ], [ -1.010742, -0.999705 ], [ -1.010742, 0.000000 ], [ 0.000000, 0.000000 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, -0.999705 ] ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 3, "x": 3, "y": 3 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 1.010690 ], [ 0.000000, 0.000000 ], [ -1.010742, 0.000000 ], [ -1.010742, 1.010690 ], [ 0.000000, 1.010690 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -1.010742, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ -1.010742, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 1.010690 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, 1.010690 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 3, "x": 4, "y": 4 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, -0.999705 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.999756, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.999756, 0.000000 ], [ 0.999756, -0.999705 ], [ 0.000000, -0.999705 ], [ 0.000000, 0.000000 ], [ 0.999756, 0.000000 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.999756, 0.000000 ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 3, "x": 4, "y": 3 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 1.010690 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, 1.010690 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.999756, 1.010690 ], [ 0.999756, 0.000000 ], [ 0.000000, 0.000000 ], [ 0.000000, 1.010690 ], [ 0.999756, 1.010690 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.999756, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.999756, 0.000000 ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 4, "x": 7, "y": 8 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -1.005249, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ -1.005249, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 0.000000 ], [ 0.000000, -0.999705 ], [ -1.005249, -0.999705 ], [ -1.005249, 0.000000 ], [ 0.000000, 0.000000 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, -0.999705 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, -0.999705 ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 4, "x": 7, "y": 7 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.000000, 1.005197 ], [ 0.000000, 0.000000 ], [ -1.005249, 0.000000 ], [ -1.005249, 1.005197 ], [ 0.000000, 1.005197 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ -1.005249, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ -1.005249, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 1.005197 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, 1.005197 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 4, "x": 8, "y": 8 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, -0.999705 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.999756, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.999756, 0.000000 ], [ 0.999756, -0.999705 ], [ 0.000000, -0.999705 ], [ 0.000000, 0.000000 ], [ 0.999756, 0.000000 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, -0.999705 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.999756, 0.000000 ] } }
] }
] }
,
{ "type": "FeatureCollection", "properties": { "zoom": 4, "x": 8, "y": 7 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 1.005197 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.000000, 1.005197 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0.999756, 1.005197 ], [ 0.999756, 0.000000 ], [ 0.000000, 0.000000 ], [ 0.000000, 1.005197 ], [ 0.999756, 1.005197 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 0.000000, 0.000000 ], [ 0.999756, 0.000000 ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.999756, 0.000000 ] } }
] }
] }
] }

View File

@ -101,25 +101,25 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
if (val.type == mvt_string) {
value = val.string_value;
type = VT_STRING;
type = mvt_string;
} else if (val.type == mvt_int) {
aprintf(&value, "%lld", (long long) val.numeric_value.int_value);
type = VT_NUMBER;
type = mvt_double;
} else if (val.type == mvt_double) {
aprintf(&value, "%g", val.numeric_value.double_value);
type = VT_NUMBER;
type = mvt_double;
} else if (val.type == mvt_float) {
aprintf(&value, "%g", val.numeric_value.float_value);
type = VT_NUMBER;
type = mvt_double;
} else if (val.type == mvt_bool) {
aprintf(&value, "%s", val.numeric_value.bool_value ? "true" : "false");
type = VT_BOOLEAN;
type = mvt_bool;
} else if (val.type == mvt_sint) {
aprintf(&value, "%lld", (long long) val.numeric_value.sint_value);
type = VT_NUMBER;
type = mvt_double;
} else if (val.type == mvt_uint) {
aprintf(&value, "%llu", (long long) val.numeric_value.uint_value);
type = VT_NUMBER;
type = mvt_double;
} else {
continue;
}
@ -144,13 +144,13 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
for (size_t i = 1; i < fields.size(); i++) {
std::string joinkey = header[i];
std::string joinval = fields[i];
int attr_type = VT_STRING;
int attr_type = mvt_string;
if (joinval.size() > 0) {
if (joinval[0] == '"') {
joinval = dequote(joinval);
} else if ((joinval[0] >= '0' && joinval[0] <= '9') || joinval[0] == '-') {
attr_type = VT_NUMBER;
attr_type = mvt_double;
}
}
@ -158,7 +158,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
if (exclude.count(joinkey) == 0) {
mvt_value outval;
if (attr_type == VT_STRING) {
if (attr_type == mvt_string) {
outval.type = mvt_string;
outval.string_value = joinval;
} else {
@ -453,7 +453,7 @@ void handle_tasks(std::map<zxy, std::vector<std::string>> &tasks, std::vector<st
}
}
void decode(struct reader *readers, char *map, std::map<std::string, layermap_entry> &layermap, sqlite3 *outdb, 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) {
void decode(struct reader *readers, char *map, std::map<std::string, layermap_entry> &layermap, sqlite3 *outdb, 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::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>());
@ -541,6 +541,12 @@ void decode(struct reader *readers, char *map, std::map<std::string, layermap_en
}
sqlite3_finalize(r->stmt);
}
if (sqlite3_prepare_v2(r->db, "SELECT value from metadata where name = 'description'", -1, &r->stmt, NULL) == SQLITE_OK) {
if (sqlite3_step(r->stmt) == SQLITE_ROW) {
description = std::string((char *) sqlite3_column_text(r->stmt, 0));
}
sqlite3_finalize(r->stmt);
}
if (sqlite3_prepare_v2(r->db, "SELECT value from metadata where name = 'bounds'", -1, &r->stmt, NULL) == SQLITE_OK) {
if (sqlite3_step(r->stmt) == SQLITE_ROW) {
const unsigned char *s = sqlite3_column_text(r->stmt, 0);
@ -727,6 +733,7 @@ int main(int argc, char **argv) {
std::map<std::string, layermap_entry> layermap;
std::string attribution;
std::string description;
struct reader *readers = NULL;
@ -744,9 +751,9 @@ int main(int argc, char **argv) {
*rr = r;
}
decode(readers, csv, layermap, outdb, &st, header, mapping, exclude, ifmatched, attribution);
decode(readers, csv, layermap, outdb, &st, header, mapping, exclude, ifmatched, attribution, description);
mbtiles_write_metadata(outdb, outfile, 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);
mbtiles_write_metadata(outdb, outfile, 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());
mbtiles_close(outdb, argv);
return 0;