mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-22 04:18:01 +00:00
Stabilize metadata field order, which seems to be causing test flakiness
This commit is contained in:
parent
e786379358
commit
2aa1510de8
29
mbtiles.c
29
mbtiles.c
@ -113,6 +113,18 @@ static void aprintf(char **buf, const char *format, ...) {
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
static int pvcmp(const void *v1, const void *v2) {
|
||||
const struct pool_val *const *pv1 = v1;
|
||||
const struct pool_val *const *pv2 = v2;
|
||||
|
||||
int n = strcmp((*pv1)->s, (*pv2)->s);
|
||||
if (n != 0) {
|
||||
return n;
|
||||
}
|
||||
|
||||
return (*pv1)->type - (*pv2)->type;
|
||||
}
|
||||
|
||||
void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, char **layername, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double midlat, double midlon, struct pool **file_keys, int nlayers) {
|
||||
char *sql, *err;
|
||||
|
||||
@ -192,8 +204,23 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, char **layername,
|
||||
quote(&buf, layername[i]);
|
||||
aprintf(&buf, "\", \"description\": \"\", \"minzoom\": %d, \"maxzoom\": %d, \"fields\": {", minzoom, maxzoom);
|
||||
|
||||
int n = 0;
|
||||
struct pool_val *pv;
|
||||
for (pv = file_keys[i]->head; pv != NULL; pv = pv->next) {
|
||||
n++;
|
||||
}
|
||||
|
||||
struct pool_val *vals[n];
|
||||
n = 0;
|
||||
for (pv = file_keys[i]->head; pv != NULL; pv = pv->next) {
|
||||
vals[n++] = pv;
|
||||
}
|
||||
|
||||
qsort(vals, n, sizeof(struct pool_val *), pvcmp);
|
||||
|
||||
int j;
|
||||
for (j = 0; j < n; j++) {
|
||||
pv = vals[j];
|
||||
aprintf(&buf, "\"");
|
||||
quote(&buf, pv->s);
|
||||
|
||||
@ -205,7 +232,7 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, char **layername,
|
||||
aprintf(&buf, "\": \"String\"");
|
||||
}
|
||||
|
||||
if (pv->next != NULL) {
|
||||
if (j + 1 < n) {
|
||||
aprintf(&buf, ", ");
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
"center": "-70.645734,25.789557,3",
|
||||
"description": "tests/multilayer/out/-ltogether_-z3.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"together\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"scalerank\": \"Number\", \"featurecla\": \"String\", \"adm0_a3\": \"String\", \"adm0_name\": \"String\", \"mapcolor9\": \"Number\", \"mapcolor13\": \"Number\", \"SCALERANK\": \"Number\", \"NATSCALE\": \"Number\", \"LABELRANK\": \"Number\", \"FEATURECLA\": \"String\", \"NAME\": \"String\", \"NAMEALT\": \"String\", \"DIFFASCII\": \"Number\", \"NAMEASCII\": \"String\", \"ADM0CAP\": \"Number\", \"CAPALT\": \"Number\", \"WORLDCITY\": \"Number\", \"MEGACITY\": \"Number\", \"SOV0NAME\": \"String\", \"SOV_A3\": \"String\", \"ADM0NAME\": \"String\", \"ADM0_A3\": \"String\", \"ADM1NAME\": \"String\", \"ISO_A2\": \"String\", \"LATITUDE\": \"Number\", \"LONGITUDE\": \"Number\", \"CHANGED\": \"Number\", \"NAMEDIFF\": \"Number\", \"POP_MAX\": \"Number\", \"POP_MIN\": \"Number\", \"POP_OTHER\": \"Number\", \"RANK_MAX\": \"Number\", \"RANK_MIN\": \"Number\", \"GEONAMEID\": \"Number\", \"MEGANAME\": \"String\", \"LS_NAME\": \"String\", \"LS_MATCH\": \"Number\", \"CHECKME\": \"Number\", \"MAX_POP10\": \"Number\", \"MAX_POP20\": \"Number\", \"MAX_POP50\": \"Number\", \"MAX_POP300\": \"Number\", \"MAX_POP310\": \"Number\", \"MAX_NATSCA\": \"Number\", \"MIN_AREAKM\": \"Number\", \"MAX_AREAKM\": \"Number\", \"MIN_AREAMI\": \"Number\", \"MAX_AREAMI\": \"Number\", \"MIN_PERKM\": \"Number\", \"MAX_PERKM\": \"Number\", \"MIN_PERMI\": \"Number\", \"MAX_PERMI\": \"Number\", \"MIN_BBXMIN\": \"Number\", \"MAX_BBXMIN\": \"Number\", \"MIN_BBXMAX\": \"Number\", \"MAX_BBXMAX\": \"Number\", \"MIN_BBYMIN\": \"Number\", \"MAX_BBYMIN\": \"Number\", \"MIN_BBYMAX\": \"Number\", \"MAX_BBYMAX\": \"Number\", \"MEAN_BBXC\": \"Number\", \"MEAN_BBYC\": \"Number\", \"COMPARE\": \"Number\", \"GN_ASCII\": \"String\", \"FEATURE_CL\": \"String\", \"FEATURE_CO\": \"String\", \"ADMIN1_COD\": \"Number\", \"GN_POP\": \"Number\", \"ELEVATION\": \"Number\", \"GTOPO30\": \"Number\", \"TIMEZONE\": \"String\", \"GEONAMESNO\": \"String\", \"UN_FID\": \"Number\", \"UN_ADM0\": \"String\", \"UN_LAT\": \"Number\", \"UN_LONG\": \"Number\", \"POP1950\": \"Number\", \"POP1955\": \"Number\", \"POP1960\": \"Number\", \"POP1965\": \"Number\", \"POP1970\": \"Number\", \"POP1975\": \"Number\", \"POP1980\": \"Number\", \"POP1985\": \"Number\", \"POP1990\": \"Number\", \"POP1995\": \"Number\", \"POP2000\": \"Number\", \"POP2005\": \"Number\", \"POP2010\": \"Number\", \"POP2015\": \"Number\", \"POP2020\": \"Number\", \"POP2025\": \"Number\", \"POP2050\": \"Number\", \"CITYALT\": \"String\", \"DIFFNOTE\": \"String\", \"CAPIN\": \"String\"} } ] }",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"together\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"ADM0CAP\": \"Number\", \"ADM0NAME\": \"String\", \"ADM0_A3\": \"String\", \"ADM1NAME\": \"String\", \"ADMIN1_COD\": \"Number\", \"CAPALT\": \"Number\", \"CAPIN\": \"String\", \"CHANGED\": \"Number\", \"CHECKME\": \"Number\", \"CITYALT\": \"String\", \"COMPARE\": \"Number\", \"DIFFASCII\": \"Number\", \"DIFFNOTE\": \"String\", \"ELEVATION\": \"Number\", \"FEATURECLA\": \"String\", \"FEATURE_CL\": \"String\", \"FEATURE_CO\": \"String\", \"GEONAMEID\": \"Number\", \"GEONAMESNO\": \"String\", \"GN_ASCII\": \"String\", \"GN_POP\": \"Number\", \"GTOPO30\": \"Number\", \"ISO_A2\": \"String\", \"LABELRANK\": \"Number\", \"LATITUDE\": \"Number\", \"LONGITUDE\": \"Number\", \"LS_MATCH\": \"Number\", \"LS_NAME\": \"String\", \"MAX_AREAKM\": \"Number\", \"MAX_AREAMI\": \"Number\", \"MAX_BBXMAX\": \"Number\", \"MAX_BBXMIN\": \"Number\", \"MAX_BBYMAX\": \"Number\", \"MAX_BBYMIN\": \"Number\", \"MAX_NATSCA\": \"Number\", \"MAX_PERKM\": \"Number\", \"MAX_PERMI\": \"Number\", \"MAX_POP10\": \"Number\", \"MAX_POP20\": \"Number\", \"MAX_POP300\": \"Number\", \"MAX_POP310\": \"Number\", \"MAX_POP50\": \"Number\", \"MEAN_BBXC\": \"Number\", \"MEAN_BBYC\": \"Number\", \"MEGACITY\": \"Number\", \"MEGANAME\": \"String\", \"MIN_AREAKM\": \"Number\", \"MIN_AREAMI\": \"Number\", \"MIN_BBXMAX\": \"Number\", \"MIN_BBXMIN\": \"Number\", \"MIN_BBYMAX\": \"Number\", \"MIN_BBYMIN\": \"Number\", \"MIN_PERKM\": \"Number\", \"MIN_PERMI\": \"Number\", \"NAME\": \"String\", \"NAMEALT\": \"String\", \"NAMEASCII\": \"String\", \"NAMEDIFF\": \"Number\", \"NATSCALE\": \"Number\", \"POP1950\": \"Number\", \"POP1955\": \"Number\", \"POP1960\": \"Number\", \"POP1965\": \"Number\", \"POP1970\": \"Number\", \"POP1975\": \"Number\", \"POP1980\": \"Number\", \"POP1985\": \"Number\", \"POP1990\": \"Number\", \"POP1995\": \"Number\", \"POP2000\": \"Number\", \"POP2005\": \"Number\", \"POP2010\": \"Number\", \"POP2015\": \"Number\", \"POP2020\": \"Number\", \"POP2025\": \"Number\", \"POP2050\": \"Number\", \"POP_MAX\": \"Number\", \"POP_MIN\": \"Number\", \"POP_OTHER\": \"Number\", \"RANK_MAX\": \"Number\", \"RANK_MIN\": \"Number\", \"SCALERANK\": \"Number\", \"SOV0NAME\": \"String\", \"SOV_A3\": \"String\", \"TIMEZONE\": \"String\", \"UN_ADM0\": \"String\", \"UN_FID\": \"Number\", \"UN_LAT\": \"Number\", \"UN_LONG\": \"Number\", \"WORLDCITY\": \"Number\", \"adm0_a3\": \"String\", \"adm0_name\": \"String\", \"featurecla\": \"String\", \"mapcolor13\": \"Number\", \"mapcolor9\": \"Number\", \"scalerank\": \"Number\"} } ] }",
|
||||
"maxzoom": "3",
|
||||
"minzoom": "0",
|
||||
"name": "tests/multilayer/out/-ltogether_-z3.json.check.mbtiles",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"center": "-70.645734,25.789557,3",
|
||||
"description": "separate",
|
||||
"format": "pbf",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"lines\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"scalerank\": \"Number\", \"featurecla\": \"String\", \"adm0_a3\": \"String\", \"adm0_name\": \"String\", \"mapcolor9\": \"Number\", \"mapcolor13\": \"Number\"} }, { \"id\": \"places\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"SCALERANK\": \"Number\", \"NATSCALE\": \"Number\", \"LABELRANK\": \"Number\", \"FEATURECLA\": \"String\", \"NAME\": \"String\", \"NAMEALT\": \"String\", \"DIFFASCII\": \"Number\", \"NAMEASCII\": \"String\", \"ADM0CAP\": \"Number\", \"CAPALT\": \"Number\", \"WORLDCITY\": \"Number\", \"MEGACITY\": \"Number\", \"SOV0NAME\": \"String\", \"SOV_A3\": \"String\", \"ADM0NAME\": \"String\", \"ADM0_A3\": \"String\", \"ADM1NAME\": \"String\", \"ISO_A2\": \"String\", \"LATITUDE\": \"Number\", \"LONGITUDE\": \"Number\", \"CHANGED\": \"Number\", \"NAMEDIFF\": \"Number\", \"POP_MAX\": \"Number\", \"POP_MIN\": \"Number\", \"POP_OTHER\": \"Number\", \"RANK_MAX\": \"Number\", \"RANK_MIN\": \"Number\", \"GEONAMEID\": \"Number\", \"MEGANAME\": \"String\", \"LS_NAME\": \"String\", \"LS_MATCH\": \"Number\", \"CHECKME\": \"Number\", \"MAX_POP10\": \"Number\", \"MAX_POP20\": \"Number\", \"MAX_POP50\": \"Number\", \"MAX_POP300\": \"Number\", \"MAX_POP310\": \"Number\", \"MAX_NATSCA\": \"Number\", \"MIN_AREAKM\": \"Number\", \"MAX_AREAKM\": \"Number\", \"MIN_AREAMI\": \"Number\", \"MAX_AREAMI\": \"Number\", \"MIN_PERKM\": \"Number\", \"MAX_PERKM\": \"Number\", \"MIN_PERMI\": \"Number\", \"MAX_PERMI\": \"Number\", \"MIN_BBXMIN\": \"Number\", \"MAX_BBXMIN\": \"Number\", \"MIN_BBXMAX\": \"Number\", \"MAX_BBXMAX\": \"Number\", \"MIN_BBYMIN\": \"Number\", \"MAX_BBYMIN\": \"Number\", \"MIN_BBYMAX\": \"Number\", \"MAX_BBYMAX\": \"Number\", \"MEAN_BBXC\": \"Number\", \"MEAN_BBYC\": \"Number\", \"COMPARE\": \"Number\", \"GN_ASCII\": \"String\", \"FEATURE_CL\": \"String\", \"FEATURE_CO\": \"String\", \"ADMIN1_COD\": \"Number\", \"GN_POP\": \"Number\", \"ELEVATION\": \"Number\", \"GTOPO30\": \"Number\", \"TIMEZONE\": \"String\", \"GEONAMESNO\": \"String\", \"UN_FID\": \"Number\", \"UN_ADM0\": \"String\", \"UN_LAT\": \"Number\", \"UN_LONG\": \"Number\", \"POP1950\": \"Number\", \"POP1955\": \"Number\", \"POP1960\": \"Number\", \"POP1965\": \"Number\", \"POP1970\": \"Number\", \"POP1975\": \"Number\", \"POP1980\": \"Number\", \"POP1985\": \"Number\", \"POP1990\": \"Number\", \"POP1995\": \"Number\", \"POP2000\": \"Number\", \"POP2005\": \"Number\", \"POP2010\": \"Number\", \"POP2015\": \"Number\", \"POP2020\": \"Number\", \"POP2025\": \"Number\", \"POP2050\": \"Number\", \"CITYALT\": \"String\", \"DIFFNOTE\": \"String\", \"CAPIN\": \"String\"} } ] }",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"lines\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"adm0_a3\": \"String\", \"adm0_name\": \"String\", \"featurecla\": \"String\", \"mapcolor13\": \"Number\", \"mapcolor9\": \"Number\", \"scalerank\": \"Number\"} }, { \"id\": \"places\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 3, \"fields\": {\"ADM0CAP\": \"Number\", \"ADM0NAME\": \"String\", \"ADM0_A3\": \"String\", \"ADM1NAME\": \"String\", \"ADMIN1_COD\": \"Number\", \"CAPALT\": \"Number\", \"CAPIN\": \"String\", \"CHANGED\": \"Number\", \"CHECKME\": \"Number\", \"CITYALT\": \"String\", \"COMPARE\": \"Number\", \"DIFFASCII\": \"Number\", \"DIFFNOTE\": \"String\", \"ELEVATION\": \"Number\", \"FEATURECLA\": \"String\", \"FEATURE_CL\": \"String\", \"FEATURE_CO\": \"String\", \"GEONAMEID\": \"Number\", \"GEONAMESNO\": \"String\", \"GN_ASCII\": \"String\", \"GN_POP\": \"Number\", \"GTOPO30\": \"Number\", \"ISO_A2\": \"String\", \"LABELRANK\": \"Number\", \"LATITUDE\": \"Number\", \"LONGITUDE\": \"Number\", \"LS_MATCH\": \"Number\", \"LS_NAME\": \"String\", \"MAX_AREAKM\": \"Number\", \"MAX_AREAMI\": \"Number\", \"MAX_BBXMAX\": \"Number\", \"MAX_BBXMIN\": \"Number\", \"MAX_BBYMAX\": \"Number\", \"MAX_BBYMIN\": \"Number\", \"MAX_NATSCA\": \"Number\", \"MAX_PERKM\": \"Number\", \"MAX_PERMI\": \"Number\", \"MAX_POP10\": \"Number\", \"MAX_POP20\": \"Number\", \"MAX_POP300\": \"Number\", \"MAX_POP310\": \"Number\", \"MAX_POP50\": \"Number\", \"MEAN_BBXC\": \"Number\", \"MEAN_BBYC\": \"Number\", \"MEGACITY\": \"Number\", \"MEGANAME\": \"String\", \"MIN_AREAKM\": \"Number\", \"MIN_AREAMI\": \"Number\", \"MIN_BBXMAX\": \"Number\", \"MIN_BBXMIN\": \"Number\", \"MIN_BBYMAX\": \"Number\", \"MIN_BBYMIN\": \"Number\", \"MIN_PERKM\": \"Number\", \"MIN_PERMI\": \"Number\", \"NAME\": \"String\", \"NAMEALT\": \"String\", \"NAMEASCII\": \"String\", \"NAMEDIFF\": \"Number\", \"NATSCALE\": \"Number\", \"POP1950\": \"Number\", \"POP1955\": \"Number\", \"POP1960\": \"Number\", \"POP1965\": \"Number\", \"POP1970\": \"Number\", \"POP1975\": \"Number\", \"POP1980\": \"Number\", \"POP1985\": \"Number\", \"POP1990\": \"Number\", \"POP1995\": \"Number\", \"POP2000\": \"Number\", \"POP2005\": \"Number\", \"POP2010\": \"Number\", \"POP2015\": \"Number\", \"POP2020\": \"Number\", \"POP2025\": \"Number\", \"POP2050\": \"Number\", \"POP_MAX\": \"Number\", \"POP_MIN\": \"Number\", \"POP_OTHER\": \"Number\", \"RANK_MAX\": \"Number\", \"RANK_MIN\": \"Number\", \"SCALERANK\": \"Number\", \"SOV0NAME\": \"String\", \"SOV_A3\": \"String\", \"TIMEZONE\": \"String\", \"UN_ADM0\": \"String\", \"UN_FID\": \"Number\", \"UN_LAT\": \"Number\", \"UN_LONG\": \"Number\", \"WORLDCITY\": \"Number\"} } ] }",
|
||||
"maxzoom": "3",
|
||||
"minzoom": "0",
|
||||
"name": "separate",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"center": "-82.968750,37.710240,7",
|
||||
"description": "tests/ne_110m_admin_1_states_provinces_lines/out/-lcountries_-P_-Z1_-z7_-b4_-xfeaturecla_-xscalerank_-acrol_-ps.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"countries\", \"description\": \"\", \"minzoom\": 1, \"maxzoom\": 7, \"fields\": {\"adm0_a3\": \"String\", \"adm0_name\": \"String\", \"mapcolor9\": \"Number\", \"mapcolor13\": \"Number\"} } ] }",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"countries\", \"description\": \"\", \"minzoom\": 1, \"maxzoom\": 7, \"fields\": {\"adm0_a3\": \"String\", \"adm0_name\": \"String\", \"mapcolor13\": \"Number\", \"mapcolor9\": \"Number\"} } ] }",
|
||||
"maxzoom": "7",
|
||||
"minzoom": "1",
|
||||
"name": "tests/ne_110m_admin_1_states_provinces_lines/out/-lcountries_-P_-Z1_-z7_-b4_-xfeaturecla_-xscalerank_-acrol_-ps.json.check.mbtiles",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"center": "-84.375000,36.466030,5",
|
||||
"description": "tests/ne_110m_admin_1_states_provinces_lines/out/-z5_-ymapcolor13_-ymapcolor9_-pSi_-d8_-D16.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 5, \"fields\": {\"mapcolor9\": \"Number\", \"mapcolor13\": \"Number\"} } ] }",
|
||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 5, \"fields\": {\"mapcolor13\": \"Number\", \"mapcolor9\": \"Number\"} } ] }",
|
||||
"maxzoom": "5",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_admin_1_states_provinces_lines/out/-z5_-ymapcolor13_-ymapcolor9_-pSi_-d8_-D16.json.check.mbtiles",
|
||||
|
Loading…
Reference in New Issue
Block a user