diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eca72e5..184a94e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,16 @@ # 2.82.1 * Fix `--use-attribute-for-id` rejecting an attribute value of 0 as a - "too-large" feature ID. The leading-zero stripping used to check that the ID - round-tripped stripped "0" down to an empty string, so the feature was left - with no ID and kept the attribute instead. + "too-large" feature ID. The check that an ID round-trips through `strtoull` + stripped all leading zeroes, turning "0" into an empty string, so the + feature was left with no ID and kept the attribute instead. (#421) +* Fix `--use-attribute-for-id` turning a negative attribute value into a huge + feature ID (-1 became 18446744073709551615). Negative values now warn and + stay attributes, as negative top-level IDs already did. (#421) +* Fix `--use-attribute-for-id` rejecting 18446744073709551615, the largest + feature ID that can be represented, as "too-large". (#421) +* Fix `--use-attribute-for-id` with `-aI` warning that an empty string was a + "too-large" feature ID; it is now reported as not a number. (#421) # 2.82.0 diff --git a/serial.cpp b/serial.cpp index 408f26f8..972d7815 100644 --- a/serial.cpp +++ b/serial.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -379,10 +380,10 @@ static long long scale_geometry(struct serialization_state *sst, long long *bbox } static std::string strip_zeroes(std::string s) { - // Doesn't do anything special with '-' followed by leading zeros - // since integer IDs must be positive - - // Keep the final digit so that an ID of 0 compares equal to "0" + // Doesn't do anything special with '-' followed by leading zeros, + // since the caller has already rejected negative IDs. + // + // Keeps the final digit, so that an ID of 0 compares equal to "0". while (s.size() > 1 && s[0] == '0') { s.erase(s.begin()); } @@ -812,16 +813,30 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf, std:: } if (*sf.full_keys[i] == attribute_for_id) { - if (sf.full_values[i].type != mvt_double && !additional[A_CONVERT_NUMERIC_IDS]) { + std::string const &id_string = sf.full_values[i].s; + bool negative = id_string.size() > 0 && id_string[0] == '-'; + + // strtoull() would accept an empty string, skip leading whitespace or a '+', + // and wrap a negative number around to a huge positive one, so require that + // the value start with a digit (or a '-', to give a better warning below). + if ((sf.full_values[i].type != mvt_double && !additional[A_CONVERT_NUMERIC_IDS]) || + (!negative && (id_string.size() == 0 || !isdigit((unsigned char) id_string[0])))) { static bool warned = false; if (!warned) { fprintf(stderr, "Warning: Attribute \"%s\"=\"%s\" as feature ID is not a number\n", sf.full_keys[i]->c_str(), sf.full_values[i].s.c_str()); warned = true; } + } else if (negative) { + static bool warned_neg = false; + + if (!warned_neg) { + fprintf(stderr, "Warning: Can't represent negative feature ID %s\n", id_string.c_str()); + warned_neg = true; + } } else { char *err; - long long id_value = strtoull(sf.full_values[i].s.c_str(), &err, 10); + unsigned long long id_value = strtoull(id_string.c_str(), &err, 10); if (err != NULL && *err != '\0') { static bool warned_frac = false; diff --git a/tests/stringid/in.json b/tests/stringid/in.json index a415f2e9..56e37138 100644 --- a/tests/stringid/in.json +++ b/tests/stringid/in.json @@ -12,3 +12,7 @@ { "type": "Feature", "properties": { "yes": "no", "special": "01005", "something": false }, "geometry": { "type": "Point", "coordinates": [ 12, 1 ] } } { "type": "Feature", "properties": { "yes": "no", "special": 0, "something": false }, "geometry": { "type": "Point", "coordinates": [ 13, 1 ] } } { "type": "Feature", "properties": { "yes": "no", "special": "0", "something": false }, "geometry": { "type": "Point", "coordinates": [ 14, 1 ] } } +{ "type": "Feature", "properties": { "yes": "no", "special": -1, "something": false }, "geometry": { "type": "Point", "coordinates": [ 15, 1 ] } } +{ "type": "Feature", "properties": { "yes": "no", "special": "-1", "something": false }, "geometry": { "type": "Point", "coordinates": [ 16, 1 ] } } +{ "type": "Feature", "properties": { "yes": "no", "special": "", "something": false }, "geometry": { "type": "Point", "coordinates": [ 17, 1 ] } } +{ "type": "Feature", "properties": { "yes": "no", "special": 18446744073709551615, "something": false }, "geometry": { "type": "Point", "coordinates": [ 18, 1 ] } } diff --git a/tests/stringid/out/-z0.json b/tests/stringid/out/-z0.json index 2954955b..b1e0ac5c 100644 --- a/tests/stringid/out/-z0.json +++ b/tests/stringid/out/-z0.json @@ -1,11 +1,11 @@ { "type": "FeatureCollection", "properties": { -"antimeridian_adjusted_bounds": "1.000000,1.000000,14.000000,1.000000", -"bounds": "1.000000,1.000000,14.000000,1.000000", +"antimeridian_adjusted_bounds": "1.000000,1.000000,18.000000,1.000000", +"bounds": "1.000000,1.000000,18.000000,1.000000", "center": "1.000000,1.000000,0", "description": "tests/stringid/out/-z0.json.check.mbtiles", "format": "pbf", "generator_options": "./tippecanoe -q -a@ -f -o tests/stringid/out/-z0.json.check.mbtiles -z0 tests/stringid/in.json", -"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"special\":\"Mixed\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":14,\"geometry\":\"Point\",\"attributeCount\":3,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"special\",\"count\":7,\"type\":\"mixed\",\"values\":[\"0\",0,\"01005\",\"27\",27,27.5,9.823748927348929e+55],\"min\":0,\"max\":9.823748927348929e+55},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", +"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"special\":\"Mixed\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":18,\"geometry\":\"Point\",\"attributeCount\":3,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"special\",\"count\":11,\"type\":\"mixed\",\"values\":[\"\",\"-1\",-1,\"0\",0,\"01005\",18446744073709551615,\"27\",27,27.5,9.823748927348929e+55],\"min\":-1,\"max\":9.823748927348929e+55},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", "maxzoom": "0", "minzoom": "0", "name": "tests/stringid/out/-z0.json.check.mbtiles", @@ -41,6 +41,14 @@ { "type": "Feature", "properties": { "yes": "no", "special": 0, "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.007812, 0.966751 ] } } , { "type": "Feature", "properties": { "yes": "no", "special": "0", "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.974609, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": -1, "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.029297, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": "-1", "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.996094, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": "", "something": false }, "geometry": { "type": "Point", "coordinates": [ 16.962891, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": 18446744073709551615, "something": false }, "geometry": { "type": "Point", "coordinates": [ 18.017578, 0.966751 ] } } ] } ] } ] } diff --git a/tests/stringid/out/-z0_--use-attribute-for-id_special.json b/tests/stringid/out/-z0_--use-attribute-for-id_special.json index 2d2ecd8d..008d0256 100644 --- a/tests/stringid/out/-z0_--use-attribute-for-id_special.json +++ b/tests/stringid/out/-z0_--use-attribute-for-id_special.json @@ -1,11 +1,11 @@ { "type": "FeatureCollection", "properties": { -"antimeridian_adjusted_bounds": "1.000000,1.000000,14.000000,1.000000", -"bounds": "1.000000,1.000000,14.000000,1.000000", +"antimeridian_adjusted_bounds": "1.000000,1.000000,18.000000,1.000000", +"bounds": "1.000000,1.000000,18.000000,1.000000", "center": "1.000000,1.000000,0", "description": "tests/stringid/out/-z0_--use-attribute-for-id_special.json.check.mbtiles", "format": "pbf", "generator_options": "./tippecanoe -q -a@ -f -o tests/stringid/out/-z0_--use-attribute-for-id_special.json.check.mbtiles -z0 --use-attribute-for-id special tests/stringid/in.json", -"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"special\":\"Mixed\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":14,\"geometry\":\"Point\",\"attributeCount\":3,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"special\",\"count\":5,\"type\":\"mixed\",\"values\":[\"0\",\"01005\",\"27\",27.5,9.823748927348929e+55],\"min\":27.5,\"max\":9.823748927348929e+55},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", +"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"special\":\"Mixed\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":18,\"geometry\":\"Point\",\"attributeCount\":3,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"special\",\"count\":8,\"type\":\"mixed\",\"values\":[\"\",\"-1\",-1,\"0\",\"01005\",\"27\",27.5,9.823748927348929e+55],\"min\":-1,\"max\":9.823748927348929e+55},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", "maxzoom": "0", "minzoom": "0", "name": "tests/stringid/out/-z0_--use-attribute-for-id_special.json.check.mbtiles", @@ -41,6 +41,14 @@ { "type": "Feature", "id": 0, "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.007812, 0.966751 ] } } , { "type": "Feature", "properties": { "yes": "no", "special": "0", "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.974609, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": -1, "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.029297, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": "-1", "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.996094, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": "", "something": false }, "geometry": { "type": "Point", "coordinates": [ 16.962891, 0.966751 ] } } +, +{ "type": "Feature", "id": 18446744073709551615, "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 18.017578, 0.966751 ] } } ] } ] } ] } diff --git a/tests/stringid/out/-z0_--use-attribute-for-id_special_-X.json b/tests/stringid/out/-z0_--use-attribute-for-id_special_-X.json index 7222abc9..2238cb5a 100644 --- a/tests/stringid/out/-z0_--use-attribute-for-id_special_-X.json +++ b/tests/stringid/out/-z0_--use-attribute-for-id_special_-X.json @@ -1,11 +1,11 @@ { "type": "FeatureCollection", "properties": { -"antimeridian_adjusted_bounds": "1.000000,1.000000,14.000000,1.000000", -"bounds": "1.000000,1.000000,14.000000,1.000000", +"antimeridian_adjusted_bounds": "1.000000,1.000000,18.000000,1.000000", +"bounds": "1.000000,1.000000,18.000000,1.000000", "center": "1.000000,1.000000,0", "description": "tests/stringid/out/-z0_--use-attribute-for-id_special_-X.json.check.mbtiles", "format": "pbf", "generator_options": "./tippecanoe -q -a@ -f -o tests/stringid/out/-z0_--use-attribute-for-id_special_-X.json.check.mbtiles -z0 --use-attribute-for-id special -X tests/stringid/in.json", -"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":14,\"geometry\":\"Point\",\"attributeCount\":0,\"attributes\":[]}]}}", +"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":18,\"geometry\":\"Point\",\"attributeCount\":0,\"attributes\":[]}]}}", "maxzoom": "0", "minzoom": "0", "name": "tests/stringid/out/-z0_--use-attribute-for-id_special_-X.json.check.mbtiles", @@ -41,6 +41,14 @@ { "type": "Feature", "id": 0, "properties": { }, "geometry": { "type": "Point", "coordinates": [ 13.007812, 0.966751 ] } } , { "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 13.974609, 0.966751 ] } } +, +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 15.029297, 0.966751 ] } } +, +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 15.996094, 0.966751 ] } } +, +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 16.962891, 0.966751 ] } } +, +{ "type": "Feature", "id": 18446744073709551615, "properties": { }, "geometry": { "type": "Point", "coordinates": [ 18.017578, 0.966751 ] } } ] } ] } ] } diff --git a/tests/stringid/out/-z0_--use-attribute-for-id_special_-xspecial.json b/tests/stringid/out/-z0_--use-attribute-for-id_special_-xspecial.json index 7bb03f7c..2f8c2e68 100644 --- a/tests/stringid/out/-z0_--use-attribute-for-id_special_-xspecial.json +++ b/tests/stringid/out/-z0_--use-attribute-for-id_special_-xspecial.json @@ -1,11 +1,11 @@ { "type": "FeatureCollection", "properties": { -"antimeridian_adjusted_bounds": "1.000000,1.000000,14.000000,1.000000", -"bounds": "1.000000,1.000000,14.000000,1.000000", +"antimeridian_adjusted_bounds": "1.000000,1.000000,18.000000,1.000000", +"bounds": "1.000000,1.000000,18.000000,1.000000", "center": "1.000000,1.000000,0", "description": "tests/stringid/out/-z0_--use-attribute-for-id_special_-xspecial.json.check.mbtiles", "format": "pbf", "generator_options": "./tippecanoe -q -a@ -f -o tests/stringid/out/-z0_--use-attribute-for-id_special_-xspecial.json.check.mbtiles -z0 --use-attribute-for-id special -xspecial tests/stringid/in.json", -"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":14,\"geometry\":\"Point\",\"attributeCount\":2,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", +"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":18,\"geometry\":\"Point\",\"attributeCount\":2,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", "maxzoom": "0", "minzoom": "0", "name": "tests/stringid/out/-z0_--use-attribute-for-id_special_-xspecial.json.check.mbtiles", @@ -41,6 +41,14 @@ { "type": "Feature", "id": 0, "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.007812, 0.966751 ] } } , { "type": "Feature", "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.974609, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.029297, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.996094, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 16.962891, 0.966751 ] } } +, +{ "type": "Feature", "id": 18446744073709551615, "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 18.017578, 0.966751 ] } } ] } ] } ] } diff --git a/tests/stringid/out/-z0_--use-attribute-for-id_special_-yother.json b/tests/stringid/out/-z0_--use-attribute-for-id_special_-yother.json index aa8e4a1e..cf36fe14 100644 --- a/tests/stringid/out/-z0_--use-attribute-for-id_special_-yother.json +++ b/tests/stringid/out/-z0_--use-attribute-for-id_special_-yother.json @@ -1,11 +1,11 @@ { "type": "FeatureCollection", "properties": { -"antimeridian_adjusted_bounds": "1.000000,1.000000,14.000000,1.000000", -"bounds": "1.000000,1.000000,14.000000,1.000000", +"antimeridian_adjusted_bounds": "1.000000,1.000000,18.000000,1.000000", +"bounds": "1.000000,1.000000,18.000000,1.000000", "center": "1.000000,1.000000,0", "description": "tests/stringid/out/-z0_--use-attribute-for-id_special_-yother.json.check.mbtiles", "format": "pbf", "generator_options": "./tippecanoe -q -a@ -f -o tests/stringid/out/-z0_--use-attribute-for-id_special_-yother.json.check.mbtiles -z0 --use-attribute-for-id special -yother tests/stringid/in.json", -"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":14,\"geometry\":\"Point\",\"attributeCount\":0,\"attributes\":[]}]}}", +"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":18,\"geometry\":\"Point\",\"attributeCount\":0,\"attributes\":[]}]}}", "maxzoom": "0", "minzoom": "0", "name": "tests/stringid/out/-z0_--use-attribute-for-id_special_-yother.json.check.mbtiles", @@ -41,6 +41,14 @@ { "type": "Feature", "id": 0, "properties": { }, "geometry": { "type": "Point", "coordinates": [ 13.007812, 0.966751 ] } } , { "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 13.974609, 0.966751 ] } } +, +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 15.029297, 0.966751 ] } } +, +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 15.996094, 0.966751 ] } } +, +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 16.962891, 0.966751 ] } } +, +{ "type": "Feature", "id": 18446744073709551615, "properties": { }, "geometry": { "type": "Point", "coordinates": [ 18.017578, 0.966751 ] } } ] } ] } ] } diff --git a/tests/stringid/out/-z0_-aI.json b/tests/stringid/out/-z0_-aI.json index 2215edcb..6990f5a1 100644 --- a/tests/stringid/out/-z0_-aI.json +++ b/tests/stringid/out/-z0_-aI.json @@ -1,11 +1,11 @@ { "type": "FeatureCollection", "properties": { -"antimeridian_adjusted_bounds": "1.000000,1.000000,14.000000,1.000000", -"bounds": "1.000000,1.000000,14.000000,1.000000", +"antimeridian_adjusted_bounds": "1.000000,1.000000,18.000000,1.000000", +"bounds": "1.000000,1.000000,18.000000,1.000000", "center": "1.000000,1.000000,0", "description": "tests/stringid/out/-z0_-aI.json.check.mbtiles", "format": "pbf", "generator_options": "./tippecanoe -q -a@ -f -o tests/stringid/out/-z0_-aI.json.check.mbtiles -z0 -aI tests/stringid/in.json", -"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"special\":\"Mixed\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":14,\"geometry\":\"Point\",\"attributeCount\":3,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"special\",\"count\":7,\"type\":\"mixed\",\"values\":[\"0\",0,\"01005\",\"27\",27,27.5,9.823748927348929e+55],\"min\":0,\"max\":9.823748927348929e+55},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", +"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"special\":\"Mixed\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":18,\"geometry\":\"Point\",\"attributeCount\":3,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"special\",\"count\":11,\"type\":\"mixed\",\"values\":[\"\",\"-1\",-1,\"0\",0,\"01005\",18446744073709551615,\"27\",27,27.5,9.823748927348929e+55],\"min\":-1,\"max\":9.823748927348929e+55},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", "maxzoom": "0", "minzoom": "0", "name": "tests/stringid/out/-z0_-aI.json.check.mbtiles", @@ -41,6 +41,14 @@ { "type": "Feature", "properties": { "yes": "no", "special": 0, "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.007812, 0.966751 ] } } , { "type": "Feature", "properties": { "yes": "no", "special": "0", "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.974609, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": -1, "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.029297, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": "-1", "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.996094, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": "", "something": false }, "geometry": { "type": "Point", "coordinates": [ 16.962891, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": 18446744073709551615, "something": false }, "geometry": { "type": "Point", "coordinates": [ 18.017578, 0.966751 ] } } ] } ] } ] } diff --git a/tests/stringid/out/-z0_-aI_--use-attribute-for-id_special.json b/tests/stringid/out/-z0_-aI_--use-attribute-for-id_special.json index cec9e66c..7fe0e0aa 100644 --- a/tests/stringid/out/-z0_-aI_--use-attribute-for-id_special.json +++ b/tests/stringid/out/-z0_-aI_--use-attribute-for-id_special.json @@ -1,11 +1,11 @@ { "type": "FeatureCollection", "properties": { -"antimeridian_adjusted_bounds": "1.000000,1.000000,14.000000,1.000000", -"bounds": "1.000000,1.000000,14.000000,1.000000", +"antimeridian_adjusted_bounds": "1.000000,1.000000,18.000000,1.000000", +"bounds": "1.000000,1.000000,18.000000,1.000000", "center": "1.000000,1.000000,0", "description": "tests/stringid/out/-z0_-aI_--use-attribute-for-id_special.json.check.mbtiles", "format": "pbf", "generator_options": "./tippecanoe -q -a@ -f -o tests/stringid/out/-z0_-aI_--use-attribute-for-id_special.json.check.mbtiles -z0 -aI --use-attribute-for-id special tests/stringid/in.json", -"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"special\":\"Number\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":14,\"geometry\":\"Point\",\"attributeCount\":3,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"special\",\"count\":2,\"type\":\"number\",\"values\":[27.5,9.823748927348929e+55],\"min\":27.5,\"max\":9.823748927348929e+55},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", +"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"something\":\"Boolean\",\"special\":\"Mixed\",\"yes\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":18,\"geometry\":\"Point\",\"attributeCount\":3,\"attributes\":[{\"attribute\":\"something\",\"count\":1,\"type\":\"boolean\",\"values\":[false]},{\"attribute\":\"special\",\"count\":5,\"type\":\"mixed\",\"values\":[\"\",\"-1\",-1,27.5,9.823748927348929e+55],\"min\":-1,\"max\":9.823748927348929e+55},{\"attribute\":\"yes\",\"count\":1,\"type\":\"string\",\"values\":[\"no\"]}]}]}}", "maxzoom": "0", "minzoom": "0", "name": "tests/stringid/out/-z0_-aI_--use-attribute-for-id_special.json.check.mbtiles", @@ -41,6 +41,14 @@ { "type": "Feature", "id": 0, "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.007812, 0.966751 ] } } , { "type": "Feature", "id": 0, "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 13.974609, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": -1, "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.029297, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": "-1", "something": false }, "geometry": { "type": "Point", "coordinates": [ 15.996094, 0.966751 ] } } +, +{ "type": "Feature", "properties": { "yes": "no", "special": "", "something": false }, "geometry": { "type": "Point", "coordinates": [ 16.962891, 0.966751 ] } } +, +{ "type": "Feature", "id": 18446744073709551615, "properties": { "yes": "no", "something": false }, "geometry": { "type": "Point", "coordinates": [ 18.017578, 0.966751 ] } } ] } ] } ] }