mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Clean up utility functions that are also used in other projects
This commit is contained in:
+7
-6
@@ -38,6 +38,7 @@ extern "C" {
|
|||||||
#include "options.hpp"
|
#include "options.hpp"
|
||||||
#include "serial.hpp"
|
#include "serial.hpp"
|
||||||
#include "text.hpp"
|
#include "text.hpp"
|
||||||
|
#include "mvt.hpp"
|
||||||
|
|
||||||
#define GEOM_POINT 0 /* array of positions */
|
#define GEOM_POINT 0 /* array of positions */
|
||||||
#define GEOM_MULTIPOINT 1 /* array of arrays of positions */
|
#define GEOM_MULTIPOINT 1 /* array of arrays of positions */
|
||||||
@@ -333,7 +334,7 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
|
|||||||
metakey[m] = properties->keys[i]->string;
|
metakey[m] = properties->keys[i]->string;
|
||||||
|
|
||||||
if (properties->values[i] != NULL && properties->values[i]->type == JSON_STRING) {
|
if (properties->values[i] != NULL && properties->values[i]->type == JSON_STRING) {
|
||||||
tas.type = metatype[m] = VT_STRING;
|
tas.type = metatype[m] = mvt_string;
|
||||||
metaval[m] = std::string(properties->values[i]->string);
|
metaval[m] = std::string(properties->values[i]->string);
|
||||||
std::string err = check_utf8(metaval[m]);
|
std::string err = check_utf8(metaval[m]);
|
||||||
if (err != "") {
|
if (err != "") {
|
||||||
@@ -343,17 +344,17 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
|
|||||||
}
|
}
|
||||||
m++;
|
m++;
|
||||||
} else if (properties->values[i] != NULL && properties->values[i]->type == JSON_NUMBER) {
|
} else if (properties->values[i] != NULL && properties->values[i]->type == JSON_NUMBER) {
|
||||||
tas.type = metatype[m] = VT_NUMBER;
|
tas.type = metatype[m] = mvt_double;
|
||||||
metaval[m] = std::string(properties->values[i]->string);
|
metaval[m] = std::string(properties->values[i]->string);
|
||||||
m++;
|
m++;
|
||||||
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_TRUE || properties->values[i]->type == JSON_FALSE)) {
|
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_TRUE || properties->values[i]->type == JSON_FALSE)) {
|
||||||
tas.type = metatype[m] = VT_BOOLEAN;
|
tas.type = metatype[m] = mvt_bool;
|
||||||
metaval[m] = std::string(properties->values[i]->type == JSON_TRUE ? "true" : "false");
|
metaval[m] = std::string(properties->values[i]->type == JSON_TRUE ? "true" : "false");
|
||||||
m++;
|
m++;
|
||||||
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_NULL)) {
|
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_NULL)) {
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
tas.type = metatype[m] = VT_STRING;
|
tas.type = metatype[m] = mvt_string;
|
||||||
const char *v = json_stringify(properties->values[i]);
|
const char *v = json_stringify(properties->values[i]);
|
||||||
metaval[m] = std::string(v);
|
metaval[m] = std::string(v);
|
||||||
free((void *) v); // stringify
|
free((void *) v); // stringify
|
||||||
@@ -464,13 +465,13 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
|
|||||||
if (inline_meta) {
|
if (inline_meta) {
|
||||||
sf.metapos = -1;
|
sf.metapos = -1;
|
||||||
for (size_t i = 0; i < m; i++) {
|
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]));
|
sf.values.push_back(addpool(poolfile, treefile, metaval[i].c_str(), metatype[i]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sf.metapos = *metapos;
|
sf.metapos = *metapos;
|
||||||
for (size_t i = 0; i < m; i++) {
|
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);
|
serialize_long_long(metafile, addpool(poolfile, treefile, metaval[i].c_str(), metatype[i]), metapos, fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,6 @@
|
|||||||
#define VT_LINETO 2
|
#define VT_LINETO 2
|
||||||
#define VT_CLOSEPATH 7
|
#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
|
// The bitfield is to make sizeof(draw) be 16 instead of 24
|
||||||
// at the cost, apparently, of a 0.7% increase in running time
|
// at the cost, apparently, of a 0.7% increase in running time
|
||||||
// for packing and unpacking.
|
// for packing and unpacking.
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ extern "C" {
|
|||||||
#include "geometry.hpp"
|
#include "geometry.hpp"
|
||||||
#include "serial.hpp"
|
#include "serial.hpp"
|
||||||
#include "options.hpp"
|
#include "options.hpp"
|
||||||
|
#include "mvt.hpp"
|
||||||
|
|
||||||
static int low_detail = 12;
|
static int low_detail = 12;
|
||||||
static int full_detail = -1;
|
static int full_detail = -1;
|
||||||
@@ -1832,7 +1833,7 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
|
|||||||
if (additional[A_CALCULATE_FEATURE_DENSITY]) {
|
if (additional[A_CALCULATE_FEATURE_DENSITY]) {
|
||||||
for (auto ai = merged_lm.begin(); ai != merged_lm.end(); ++ai) {
|
for (auto ai = merged_lm.begin(); ai != merged_lm.end(); ++ai) {
|
||||||
type_and_string tas;
|
type_and_string tas;
|
||||||
tas.type = VT_NUMBER;
|
tas.type = mvt_double;
|
||||||
tas.string = "tippecanoe_feature_density";
|
tas.string = "tippecanoe_feature_density";
|
||||||
ai->second.file_keys.insert(tas);
|
ai->second.file_keys.insert(tas);
|
||||||
}
|
}
|
||||||
@@ -1842,7 +1843,7 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
|
|||||||
ai->second.minzoom = minzoom;
|
ai->second.minzoom = minzoom;
|
||||||
ai->second.maxzoom = maxzoom;
|
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);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
+51
-47
@@ -11,10 +11,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "main.hpp"
|
#include "mvt.hpp"
|
||||||
#include "pool.hpp"
|
|
||||||
#include "mbtiles.hpp"
|
#include "mbtiles.hpp"
|
||||||
#include "geometry.hpp"
|
|
||||||
|
|
||||||
sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable) {
|
sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable) {
|
||||||
sqlite3 *outdb;
|
sqlite3 *outdb;
|
||||||
@@ -133,7 +131,7 @@ bool type_and_string::operator<(const type_and_string &o) const {
|
|||||||
return false;
|
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) {
|
||||||
char *sql, *err;
|
char *sql, *err;
|
||||||
|
|
||||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('name', %Q);", fname);
|
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('name', %Q);", fname);
|
||||||
@@ -219,7 +217,7 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, int minzoom, int
|
|||||||
sqlite3_free(sql);
|
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) {
|
if (sqlite3_exec(outdb, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||||
fprintf(stderr, "set format: %s\n", err);
|
fprintf(stderr, "set format: %s\n", err);
|
||||||
if (!forcetable) {
|
if (!forcetable) {
|
||||||
@@ -228,58 +226,64 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, int minzoom, int
|
|||||||
}
|
}
|
||||||
sqlite3_free(sql);
|
sqlite3_free(sql);
|
||||||
|
|
||||||
std::string buf("{");
|
if (vector) {
|
||||||
aprintf(&buf, "\"vector_layers\": [ ");
|
std::string buf("{");
|
||||||
|
aprintf(&buf, "\"vector_layers\": [ ");
|
||||||
|
|
||||||
std::vector<std::string> lnames;
|
std::vector<std::string> lnames;
|
||||||
for (auto ai = layermap.begin(); ai != layermap.end(); ++ai) {
|
for (auto ai = layermap.begin(); ai != layermap.end(); ++ai) {
|
||||||
lnames.push_back(ai->first);
|
lnames.push_back(ai->first);
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < lnames.size(); i++) {
|
|
||||||
if (i != 0) {
|
|
||||||
aprintf(&buf, ", ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto fk = layermap.find(lnames[i]);
|
for (size_t i = 0; i < lnames.size(); i++) {
|
||||||
aprintf(&buf, "{ \"id\": \"");
|
if (i != 0) {
|
||||||
quote(&buf, lnames[i].c_str());
|
|
||||||
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 {
|
|
||||||
aprintf(&buf, ", ");
|
aprintf(&buf, ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
aprintf(&buf, "\"");
|
auto fk = layermap.find(lnames[i]);
|
||||||
quote(&buf, j->string.c_str());
|
aprintf(&buf, "{ \"id\": \"");
|
||||||
|
quote(&buf, lnames[i].c_str());
|
||||||
|
aprintf(&buf, "\", \"description\": \"\", \"minzoom\": %d, \"maxzoom\": %d, \"fields\": {", fk->second.minzoom, fk->second.maxzoom);
|
||||||
|
|
||||||
if (j->type == VT_NUMBER) {
|
std::set<type_and_string>::iterator j;
|
||||||
aprintf(&buf, "\": \"Number\"");
|
bool first = true;
|
||||||
} else if (j->type == VT_BOOLEAN) {
|
for (j = fk->second.file_keys.begin(); j != fk->second.file_keys.end(); ++j) {
|
||||||
aprintf(&buf, "\": \"Boolean\"");
|
if (first) {
|
||||||
} else {
|
first = false;
|
||||||
aprintf(&buf, "\": \"String\"");
|
} else {
|
||||||
|
aprintf(&buf, ", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
aprintf(&buf, "\"");
|
||||||
|
quote(&buf, j->string.c_str());
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sqlite3_free(sql);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sqlite3_free(sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbtiles_close(sqlite3 *outdb, char **argv) {
|
void mbtiles_close(sqlite3 *outdb, char **argv) {
|
||||||
|
|||||||
+1
-1
@@ -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_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);
|
||||||
|
|
||||||
void mbtiles_close(sqlite3 *outdb, char **argv);
|
void mbtiles_close(sqlite3 *outdb, char **argv);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,18 @@ struct mvt_geometry {
|
|||||||
int /* mvt_operation */ op;
|
int /* mvt_operation */ op;
|
||||||
|
|
||||||
mvt_geometry(int op, long long x, long long y);
|
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 {
|
enum mvt_geometry_type {
|
||||||
|
|||||||
+23
-4
@@ -83,13 +83,32 @@ unsigned long long encode(unsigned int wx, unsigned int wy) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned char decodex[256];
|
||||||
|
static unsigned char decodey[256];
|
||||||
|
|
||||||
void decode(unsigned long long index, unsigned *wx, unsigned *wy) {
|
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;
|
*wx = *wy = 0;
|
||||||
|
|
||||||
int i;
|
for (size_t i = 0; i < 8; i++) {
|
||||||
for (i = 0; i < 32; i++) {
|
*wx |= ((unsigned) decodex[(index >> (8 * i)) & 0xFF]) << (4 * i);
|
||||||
*wx |= ((index >> (64 - 2 * (i + 1) + 1)) & 1) << (32 - (i + 1));
|
*wy |= ((unsigned) decodey[(index >> (8 * i)) & 0xFF]) << (4 * i);
|
||||||
*wy |= ((index >> (64 - 2 * (i + 1) + 0)) & 1) << (32 - (i + 1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -101,25 +101,25 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
|
|||||||
|
|
||||||
if (val.type == mvt_string) {
|
if (val.type == mvt_string) {
|
||||||
value = val.string_value;
|
value = val.string_value;
|
||||||
type = VT_STRING;
|
type = mvt_string;
|
||||||
} else if (val.type == mvt_int) {
|
} else if (val.type == mvt_int) {
|
||||||
aprintf(&value, "%lld", (long long) val.numeric_value.int_value);
|
aprintf(&value, "%lld", (long long) val.numeric_value.int_value);
|
||||||
type = VT_NUMBER;
|
type = mvt_double;
|
||||||
} else if (val.type == mvt_double) {
|
} else if (val.type == mvt_double) {
|
||||||
aprintf(&value, "%g", val.numeric_value.double_value);
|
aprintf(&value, "%g", val.numeric_value.double_value);
|
||||||
type = VT_NUMBER;
|
type = mvt_double;
|
||||||
} else if (val.type == mvt_float) {
|
} else if (val.type == mvt_float) {
|
||||||
aprintf(&value, "%g", val.numeric_value.float_value);
|
aprintf(&value, "%g", val.numeric_value.float_value);
|
||||||
type = VT_NUMBER;
|
type = mvt_double;
|
||||||
} else if (val.type == mvt_bool) {
|
} else if (val.type == mvt_bool) {
|
||||||
aprintf(&value, "%s", val.numeric_value.bool_value ? "true" : "false");
|
aprintf(&value, "%s", val.numeric_value.bool_value ? "true" : "false");
|
||||||
type = VT_BOOLEAN;
|
type = mvt_bool;
|
||||||
} else if (val.type == mvt_sint) {
|
} else if (val.type == mvt_sint) {
|
||||||
aprintf(&value, "%lld", (long long) val.numeric_value.sint_value);
|
aprintf(&value, "%lld", (long long) val.numeric_value.sint_value);
|
||||||
type = VT_NUMBER;
|
type = mvt_double;
|
||||||
} else if (val.type == mvt_uint) {
|
} else if (val.type == mvt_uint) {
|
||||||
aprintf(&value, "%llu", (long long) val.numeric_value.uint_value);
|
aprintf(&value, "%llu", (long long) val.numeric_value.uint_value);
|
||||||
type = VT_NUMBER;
|
type = mvt_double;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
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++) {
|
for (size_t i = 1; i < fields.size(); i++) {
|
||||||
std::string joinkey = header[i];
|
std::string joinkey = header[i];
|
||||||
std::string joinval = fields[i];
|
std::string joinval = fields[i];
|
||||||
int attr_type = VT_STRING;
|
int attr_type = mvt_string;
|
||||||
|
|
||||||
if (joinval.size() > 0) {
|
if (joinval.size() > 0) {
|
||||||
if (joinval[0] == '"') {
|
if (joinval[0] == '"') {
|
||||||
joinval = dequote(joinval);
|
joinval = dequote(joinval);
|
||||||
} else if ((joinval[0] >= '0' && joinval[0] <= '9') || joinval[0] == '-') {
|
} 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) {
|
if (exclude.count(joinkey) == 0) {
|
||||||
mvt_value outval;
|
mvt_value outval;
|
||||||
if (attr_type == VT_STRING) {
|
if (attr_type == mvt_string) {
|
||||||
outval.type = mvt_string;
|
outval.type = mvt_string;
|
||||||
outval.string_value = joinval;
|
outval.string_value = joinval;
|
||||||
} else {
|
} else {
|
||||||
@@ -743,7 +743,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
decode(readers, csv, layermap, outdb, &st, header, mapping, exclude, ifmatched, attribution);
|
decode(readers, csv, layermap, outdb, &st, header, mapping, exclude, ifmatched, attribution);
|
||||||
|
|
||||||
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);
|
||||||
mbtiles_close(outdb, argv);
|
mbtiles_close(outdb, argv);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ mvt_value retrieve_string(long long off, char *stringpool, int *otype) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mvt_value tv;
|
mvt_value tv;
|
||||||
if (type == VT_NUMBER) {
|
if (type == mvt_double) {
|
||||||
long long v;
|
long long v;
|
||||||
if (is_integer(s, &v)) {
|
if (is_integer(s, &v)) {
|
||||||
if (v >= 0) {
|
if (v >= 0) {
|
||||||
@@ -156,7 +156,7 @@ mvt_value retrieve_string(long long off, char *stringpool, int *otype) {
|
|||||||
tv.numeric_value.double_value = d;
|
tv.numeric_value.double_value = d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == VT_BOOLEAN) {
|
} else if (type == mvt_bool) {
|
||||||
tv.type = mvt_bool;
|
tv.type = mvt_bool;
|
||||||
tv.numeric_value.bool_value = (s[0] == 't');
|
tv.numeric_value.bool_value = (s[0] == 't');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user