diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ecea6781..908a59d4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.32.1 + +* Fix null pointer crash when reading filter output that does not + tag features with their extent +* Add `--clip-bounding-box` option to clip input geometry + ## 1.32.0 * Fix a bug that allowed coalescing of features with mismatched attributes diff --git a/README.md b/README.md index 11fd910d7..416fa1804 100644 --- a/README.md +++ b/README.md @@ -447,6 +447,7 @@ the same layer, enclose them in an `all` expression so they will all be evaluate * `-aw` or `--detect-longitude-wraparound`: Detect when adjacent points within a feature jump to the other side of the world, and try to fix the geometry. * `-pw` or `--use-source-polygon-winding`: Instead of respecting GeoJSON polygon ring order, use the original polygon winding in the source data to distinguish inner (clockwise) and outer (counterclockwise) polygon rings. * `-pW` or `--reverse-source-polygon-winding`: Instead of respecting GeoJSON polygon ring order, use the opposite of the original polygon winding in the source data to distinguish inner (counterclockwise) and outer (clockwise) polygon rings. + * `--clip-bounding-box=`*minlon*`,`*minlat*`,`*maxlon*`,`*maxlat*: Clip all features to the specified bounding box. ### Setting or disabling tile size limits diff --git a/geometry.cpp b/geometry.cpp index 6f69abec0..aa72fddb5 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -595,16 +595,20 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double } drawvec clip_point(drawvec &geom, int z, long long buffer) { - drawvec out; - long long min = 0; long long area = 1LL << (32 - z); min -= buffer * area / 256; area += buffer * area / 256; + return clip_point(geom, min, min, area, area); +} + +drawvec clip_point(drawvec &geom, long long minx, long long miny, long long maxx, long long maxy) { + drawvec out; + for (size_t i = 0; i < geom.size(); i++) { - if (geom[i].x >= min && geom[i].y >= min && geom[i].x <= area && geom[i].y <= area) { + if (geom[i].x >= minx && geom[i].y >= miny && geom[i].x <= maxx && geom[i].y <= maxy) { out.push_back(geom[i]); } } @@ -646,13 +650,17 @@ bool point_within_tile(long long x, long long y, int z) { } drawvec clip_lines(drawvec &geom, int z, long long buffer) { - drawvec out; - long long min = 0; long long area = 1LL << (32 - z); min -= buffer * area / 256; area += buffer * area / 256; + return clip_lines(geom, min, min, area, area); +} + +drawvec clip_lines(drawvec &geom, long long minx, long long miny, long long maxx, long long maxy) { + drawvec out; + for (size_t i = 0; i < geom.size(); i++) { if (i > 0 && (geom[i - 1].op == VT_MOVETO || geom[i - 1].op == VT_LINETO) && geom[i].op == VT_LINETO) { double x1 = geom[i - 1].x; @@ -661,7 +669,7 @@ drawvec clip_lines(drawvec &geom, int z, long long buffer) { double x2 = geom[i - 0].x; double y2 = geom[i - 0].y; - int c = clip(&x1, &y1, &x2, &y2, min, min, area, area); + int c = clip(&x1, &y1, &x2, &y2, minx, miny, maxx, maxy); if (c > 1) { // clipped out.push_back(draw(VT_MOVETO, x1, y1)); diff --git a/geometry.hpp b/geometry.hpp index d9121dcbc..1e45a0b53 100644 --- a/geometry.hpp +++ b/geometry.hpp @@ -76,4 +76,8 @@ void check_polygon(drawvec &geom); double get_area(drawvec &geom, size_t i, size_t j); double get_mp_area(drawvec &geom); +drawvec simple_clip_poly(drawvec &geom, long long x1, long long y1, long long x2, long long y2); +drawvec clip_lines(drawvec &geom, long long x1, long long y1, long long x2, long long y2); +drawvec clip_point(drawvec &geom, long long x1, long long y1, long long x2, long long y2); + #endif diff --git a/main.cpp b/main.cpp index 3abb5947d..4031ee4c6 100644 --- a/main.cpp +++ b/main.cpp @@ -93,6 +93,8 @@ long long MAX_FILES; static long long diskfree; char **av; +std::vector clipbboxes; + void checkdisk(std::vector *r) { long long used = 0; for (size_t i = 0; i < r->size(); i++) { @@ -2594,6 +2596,7 @@ int main(int argc, char **argv) { {"detect-longitude-wraparound", no_argument, &additional[A_DETECT_WRAPAROUND], 1}, {"use-source-polygon-winding", no_argument, &prevent[P_USE_SOURCE_POLYGON_WINDING], 1}, {"reverse-source-polygon-winding", no_argument, &prevent[P_REVERSE_SOURCE_POLYGON_WINDING], 1}, + {"clip-bounding-box", required_argument, 0, '~'}, {"Filtering tile contents", 0, 0, 0}, {"prefilter", required_argument, 0, 'C'}, @@ -2682,6 +2685,17 @@ int main(int argc, char **argv) { max_tilestats_sample_values = atoi(optarg); } else if (strcmp(opt, "tile-stats-values-limit") == 0) { max_tilestats_values = atoi(optarg); + } else if (strcmp(opt, "clip-bounding-box") == 0) { + clipbbox clip; + if (sscanf(optarg, "%lf,%lf,%lf,%lf", &clip.lon1, &clip.lat1, &clip.lon2, &clip.lat2) == 4) { + clipbboxes.push_back(clip); + } else { + fprintf(stderr, "%s: Can't parse bounding box --%s=%s\n", argv[0], opt, optarg); + exit(EXIT_FAILURE); + } + } else { + fprintf(stderr, "%s: Unrecognized option --%s\n", argv[0], opt); + exit(EXIT_FAILURE); } break; } @@ -3003,6 +3017,14 @@ int main(int argc, char **argv) { } } + // Wait until here to project the bounding box, so that the behavior is + // the same no matter what order the projection and bounding box are + // specified in + for (auto &c : clipbboxes) { + projection->project(c.lon1, c.lat1, 32, &c.minx, &c.maxy); + projection->project(c.lon2, c.lat2, 32, &c.maxx, &c.miny); + } + if (max_tilestats_sample_values < max_tilestats_values) { max_tilestats_sample_values = max_tilestats_values; } diff --git a/main.hpp b/main.hpp index 9a74a9214..2d83c8abb 100644 --- a/main.hpp +++ b/main.hpp @@ -18,6 +18,20 @@ struct index { } }; +struct clipbbox { + double lon1; + double lat1; + double lon2; + double lat2; + + long long minx; + long long miny; + long long maxx; + long long maxy; +}; + +extern std::vector clipbboxes; + void checkdisk(std::vector *r); extern int geometry_scale; diff --git a/man/tippecanoe.1 b/man/tippecanoe.1 index 534d7d034..61f8bff2b 100644 --- a/man/tippecanoe.1 +++ b/man/tippecanoe.1 @@ -560,6 +560,8 @@ the line or polygon within one tile unit of its proper location. You can probabl \fB\fC\-pw\fR or \fB\fC\-\-use\-source\-polygon\-winding\fR: Instead of respecting GeoJSON polygon ring order, use the original polygon winding in the source data to distinguish inner (clockwise) and outer (counterclockwise) polygon rings. .IP \(bu 2 \fB\fC\-pW\fR or \fB\fC\-\-reverse\-source\-polygon\-winding\fR: Instead of respecting GeoJSON polygon ring order, use the opposite of the original polygon winding in the source data to distinguish inner (counterclockwise) and outer (clockwise) polygon rings. +.IP \(bu 2 +\fB\fC\-\-clip\-bounding\-box=\fR\fIminlon\fP\fB\fC,\fR\fIminlat\fP\fB\fC,\fR\fImaxlon\fP\fB\fC,\fR\fImaxlat\fP: Clip all features to the specified bounding box. .RE .SS Setting or disabling tile size limits .RS diff --git a/plugin.cpp b/plugin.cpp index b1f541322..d416299da 100644 --- a/plugin.cpp +++ b/plugin.cpp @@ -419,7 +419,7 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std:: } json_object *extent = json_hash_get(tippecanoe, "extent"); - if (extent != NULL && sequence->type == JSON_NUMBER) { + if (extent != NULL && extent->type == JSON_NUMBER) { sf.extent = extent->number; } diff --git a/serial.cpp b/serial.cpp index 6047be47c..59697ab6e 100644 --- a/serial.cpp +++ b/serial.cpp @@ -387,6 +387,45 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) { sf.geometry = fix_polygon(sf.geometry); } + for (auto &c : clipbboxes) { + if (sf.t == VT_POLYGON) { + sf.geometry = simple_clip_poly(sf.geometry, c.minx >> geometry_scale, c.miny >> geometry_scale, c.maxx >> geometry_scale, c.maxy >> geometry_scale); + } else if (sf.t == VT_LINE) { + sf.geometry = clip_lines(sf.geometry, c.minx >> geometry_scale, c.miny >> geometry_scale, c.maxx >> geometry_scale, c.maxy >> geometry_scale); + sf.geometry = remove_noop(sf.geometry, sf.t, 0); + } else if (sf.t == VT_POINT) { + sf.geometry = clip_point(sf.geometry, c.minx >> geometry_scale, c.miny >> geometry_scale, c.maxx >> geometry_scale, c.maxy >> geometry_scale); + } + + sf.bbox[0] = LLONG_MAX; + sf.bbox[1] = LLONG_MAX; + sf.bbox[2] = LLONG_MIN; + sf.bbox[3] = LLONG_MIN; + + for (auto &g : sf.geometry) { + long long x = g.x << geometry_scale; + long long y = g.y << geometry_scale; + + if (x < sf.bbox[0]) { + sf.bbox[0] = x; + } + if (y < sf.bbox[1]) { + sf.bbox[1] = y; + } + if (x > sf.bbox[2]) { + sf.bbox[2] = x; + } + if (y > sf.bbox[3]) { + sf.bbox[3] = y; + } + } + } + + if (sf.geometry.size() == 0) { + // Feature was clipped away + return 1; + } + if (!sf.has_id) { if (additional[A_GENERATE_IDS]) { sf.has_id = true; diff --git a/tests/ne_110m_admin_0_countries/out/-z0_--clip-bounding-box_-110,27,-92,52.json b/tests/ne_110m_admin_0_countries/out/-z0_--clip-bounding-box_-110,27,-92,52.json new file mode 100644 index 000000000..66748549d --- /dev/null +++ b/tests/ne_110m_admin_0_countries/out/-z0_--clip-bounding-box_-110,27,-92,52.json @@ -0,0 +1,22 @@ +{ "type": "FeatureCollection", "properties": { +"bounds": "-110.039063,27.059126,-92.021484,52.052490", +"center": "-92.021484,27.059126,0", +"description": "tests/ne_110m_admin_0_countries/out/-z0_--clip-bounding-box_-110,27,-92,52.json.check.mbtiles", +"format": "pbf", +"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"abbrev\": \"String\", \"abbrev_len\": \"Number\", \"adm0_a3\": \"String\", \"adm0_a3_is\": \"String\", \"adm0_a3_un\": \"Number\", \"adm0_a3_us\": \"String\", \"adm0_a3_wb\": \"Number\", \"adm0_dif\": \"Number\", \"admin\": \"String\", \"brk_a3\": \"String\", \"brk_diff\": \"Number\", \"brk_name\": \"String\", \"continent\": \"String\", \"economy\": \"String\", \"featurecla\": \"String\", \"formal_en\": \"String\", \"gdp_md_est\": \"Number\", \"gdp_year\": \"Number\", \"geou_dif\": \"Number\", \"geounit\": \"String\", \"gu_a3\": \"String\", \"homepart\": \"Number\", \"income_grp\": \"String\", \"iso_a2\": \"String\", \"iso_a3\": \"String\", \"iso_n3\": \"String\", \"labelrank\": \"Number\", \"lastcensus\": \"Number\", \"level\": \"Number\", \"long_len\": \"Number\", \"mapcolor13\": \"Number\", \"mapcolor7\": \"Number\", \"mapcolor8\": \"Number\", \"mapcolor9\": \"Number\", \"name\": \"String\", \"name_len\": \"Number\", \"name_long\": \"String\", \"name_sort\": \"String\", \"pop_est\": \"Number\", \"pop_year\": \"Number\", \"postal\": \"String\", \"region_un\": \"String\", \"region_wb\": \"String\", \"scalerank\": \"Number\", \"sov_a3\": \"String\", \"sovereignt\": \"String\", \"su_a3\": \"String\", \"su_dif\": \"Number\", \"subregion\": \"String\", \"subunit\": \"String\", \"tiny\": \"Number\", \"type\": \"String\", \"un_a3\": \"String\", \"wb_a2\": \"String\", \"wb_a3\": \"String\", \"wikipedia\": \"Number\", \"woe_id\": \"Number\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 3,\"geometry\": \"Polygon\",\"attributeCount\": 57,\"attributes\": [{\"attribute\": \"abbrev\",\"count\": 3,\"type\": \"string\",\"values\": [\"Can.\",\"Mex.\",\"U.S.A.\"]},{\"attribute\": \"abbrev_len\",\"count\": 2,\"type\": \"number\",\"values\": [4,6],\"min\": 4,\"max\": 6},{\"attribute\": \"adm0_a3\",\"count\": 3,\"type\": \"string\",\"values\": [\"CAN\",\"MEX\",\"USA\"]},{\"attribute\": \"adm0_a3_is\",\"count\": 3,\"type\": \"string\",\"values\": [\"CAN\",\"MEX\",\"USA\"]},{\"attribute\": \"adm0_a3_un\",\"count\": 1,\"type\": \"number\",\"values\": [-99],\"min\": -99,\"max\": -99},{\"attribute\": \"adm0_a3_us\",\"count\": 3,\"type\": \"string\",\"values\": [\"CAN\",\"MEX\",\"USA\"]},{\"attribute\": \"adm0_a3_wb\",\"count\": 1,\"type\": \"number\",\"values\": [-99],\"min\": -99,\"max\": -99},{\"attribute\": \"adm0_dif\",\"count\": 2,\"type\": \"number\",\"values\": [0,1],\"min\": 0,\"max\": 1},{\"attribute\": \"admin\",\"count\": 3,\"type\": \"string\",\"values\": [\"Canada\",\"Mexico\",\"United States of America\"]},{\"attribute\": \"brk_a3\",\"count\": 3,\"type\": \"string\",\"values\": [\"CAN\",\"MEX\",\"USA\"]},{\"attribute\": \"brk_diff\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"brk_name\",\"count\": 3,\"type\": \"string\",\"values\": [\"Canada\",\"Mexico\",\"United States\"]},{\"attribute\": \"continent\",\"count\": 1,\"type\": \"string\",\"values\": [\"North America\"]},{\"attribute\": \"economy\",\"count\": 2,\"type\": \"string\",\"values\": [\"1. Developed region: G7\",\"4. Emerging region: MIKT\"]},{\"attribute\": \"featurecla\",\"count\": 1,\"type\": \"string\",\"values\": [\"Admin-0 country\"]},{\"attribute\": \"formal_en\",\"count\": 3,\"type\": \"string\",\"values\": [\"Canada\",\"United Mexican States\",\"United States of America\"]},{\"attribute\": \"gdp_md_est\",\"count\": 3,\"type\": \"number\",\"values\": [1300000,15094000,1563000],\"min\": 1300000,\"max\": 15094000},{\"attribute\": \"gdp_year\",\"count\": 2,\"type\": \"number\",\"values\": [-99,0],\"min\": -99,\"max\": 0},{\"attribute\": \"geou_dif\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"geounit\",\"count\": 3,\"type\": \"string\",\"values\": [\"Canada\",\"Mexico\",\"United States of America\"]},{\"attribute\": \"gu_a3\",\"count\": 3,\"type\": \"string\",\"values\": [\"CAN\",\"MEX\",\"USA\"]},{\"attribute\": \"homepart\",\"count\": 1,\"type\": \"number\",\"values\": [1],\"min\": 1,\"max\": 1},{\"attribute\": \"income_grp\",\"count\": 2,\"type\": \"string\",\"values\": [\"1. High income: OECD\",\"3. Upper middle income\"]},{\"attribute\": \"iso_a2\",\"count\": 3,\"type\": \"string\",\"values\": [\"CA\",\"MX\",\"US\"]},{\"attribute\": \"iso_a3\",\"count\": 3,\"type\": \"string\",\"values\": [\"CAN\",\"MEX\",\"USA\"]},{\"attribute\": \"iso_n3\",\"count\": 3,\"type\": \"string\",\"values\": [\"124\",\"484\",\"840\"]},{\"attribute\": \"labelrank\",\"count\": 1,\"type\": \"number\",\"values\": [2],\"min\": 2,\"max\": 2},{\"attribute\": \"lastcensus\",\"count\": 2,\"type\": \"number\",\"values\": [2010,2011],\"min\": 2010,\"max\": 2011},{\"attribute\": \"level\",\"count\": 1,\"type\": \"number\",\"values\": [2],\"min\": 2,\"max\": 2},{\"attribute\": \"long_len\",\"count\": 2,\"type\": \"number\",\"values\": [13,6],\"min\": 6,\"max\": 13},{\"attribute\": \"mapcolor13\",\"count\": 3,\"type\": \"number\",\"values\": [1,2,3],\"min\": 1,\"max\": 3},{\"attribute\": \"mapcolor7\",\"count\": 2,\"type\": \"number\",\"values\": [4,6],\"min\": 4,\"max\": 6},{\"attribute\": \"mapcolor8\",\"count\": 3,\"type\": \"number\",\"values\": [1,5,6],\"min\": 1,\"max\": 6},{\"attribute\": \"mapcolor9\",\"count\": 3,\"type\": \"number\",\"values\": [1,2,7],\"min\": 1,\"max\": 7},{\"attribute\": \"name\",\"count\": 3,\"type\": \"string\",\"values\": [\"Canada\",\"Mexico\",\"United States\"]},{\"attribute\": \"name_len\",\"count\": 2,\"type\": \"number\",\"values\": [13,6],\"min\": 6,\"max\": 13},{\"attribute\": \"name_long\",\"count\": 3,\"type\": \"string\",\"values\": [\"Canada\",\"Mexico\",\"United States\"]},{\"attribute\": \"name_sort\",\"count\": 3,\"type\": \"string\",\"values\": [\"Canada\",\"Mexico\",\"United States of America\"]},{\"attribute\": \"pop_est\",\"count\": 3,\"type\": \"number\",\"values\": [111211789,313973000,33487208],\"min\": 33487208,\"max\": 313973000},{\"attribute\": \"pop_year\",\"count\": 2,\"type\": \"number\",\"values\": [-99,0],\"min\": -99,\"max\": 0},{\"attribute\": \"postal\",\"count\": 3,\"type\": \"string\",\"values\": [\"CA\",\"MX\",\"US\"]},{\"attribute\": \"region_un\",\"count\": 1,\"type\": \"string\",\"values\": [\"Americas\"]},{\"attribute\": \"region_wb\",\"count\": 2,\"type\": \"string\",\"values\": [\"Latin America & Caribbean\",\"North America\"]},{\"attribute\": \"scalerank\",\"count\": 1,\"type\": \"number\",\"values\": [1],\"min\": 1,\"max\": 1},{\"attribute\": \"sov_a3\",\"count\": 3,\"type\": \"string\",\"values\": [\"CAN\",\"MEX\",\"US1\"]},{\"attribute\": \"sovereignt\",\"count\": 3,\"type\": \"string\",\"values\": [\"Canada\",\"Mexico\",\"United States of America\"]},{\"attribute\": \"su_a3\",\"count\": 3,\"type\": \"string\",\"values\": [\"CAN\",\"MEX\",\"USA\"]},{\"attribute\": \"su_dif\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"subregion\",\"count\": 2,\"type\": \"string\",\"values\": [\"Central America\",\"Northern America\"]},{\"attribute\": \"subunit\",\"count\": 3,\"type\": \"string\",\"values\": [\"Canada\",\"Mexico\",\"United States of America\"]},{\"attribute\": \"tiny\",\"count\": 1,\"type\": \"number\",\"values\": [-99],\"min\": -99,\"max\": -99},{\"attribute\": \"type\",\"count\": 2,\"type\": \"string\",\"values\": [\"Country\",\"Sovereign country\"]},{\"attribute\": \"un_a3\",\"count\": 3,\"type\": \"string\",\"values\": [\"124\",\"484\",\"840\"]},{\"attribute\": \"wb_a2\",\"count\": 3,\"type\": \"string\",\"values\": [\"CA\",\"MX\",\"US\"]},{\"attribute\": \"wb_a3\",\"count\": 3,\"type\": \"string\",\"values\": [\"CAN\",\"MEX\",\"USA\"]},{\"attribute\": \"wikipedia\",\"count\": 2,\"type\": \"number\",\"values\": [-99,0],\"min\": -99,\"max\": 0},{\"attribute\": \"woe_id\",\"count\": 1,\"type\": \"number\",\"values\": [-99],\"min\": -99,\"max\": -99}]}]}}", +"maxzoom": "0", +"minzoom": "0", +"name": "tests/ne_110m_admin_0_countries/out/-z0_--clip-bounding-box_-110,27,-92,52.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": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 2, "sovereignt": "Canada", "sov_a3": "CAN", "adm0_dif": 0, "level": 2, "type": "Sovereign country", "admin": "Canada", "adm0_a3": "CAN", "geou_dif": 0, "geounit": "Canada", "gu_a3": "CAN", "su_dif": 0, "subunit": "Canada", "su_a3": "CAN", "brk_diff": 0, "name": "Canada", "name_long": "Canada", "brk_a3": "CAN", "brk_name": "Canada", "abbrev": "Can.", "postal": "CA", "formal_en": "Canada", "name_sort": "Canada", "mapcolor7": 6, "mapcolor8": 6, "mapcolor9": 2, "mapcolor13": 2, "pop_est": 33487208, "gdp_md_est": 1300000, "pop_year": -99, "lastcensus": 2011, "gdp_year": -99, "economy": "1. Developed region: G7", "income_grp": "1. High income: OECD", "wikipedia": -99, "iso_a2": "CA", "iso_a3": "CAN", "iso_n3": "124", "un_a3": "124", "wb_a2": "CA", "wb_a3": "CAN", "woe_id": -99, "adm0_a3_is": "CAN", "adm0_a3_us": "CAN", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "North America", "region_un": "Americas", "subregion": "Northern America", "region_wb": "North America", "name_len": 6, "long_len": 6, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -92.021484, 52.052490 ], [ -92.021484, 48.283193 ], [ -92.636719, 48.458352 ], [ -94.394531, 48.690960 ], [ -94.658203, 48.864715 ], [ -94.833984, 49.439557 ], [ -95.185547, 49.439557 ], [ -95.185547, 49.037868 ], [ -110.039062, 49.037868 ], [ -110.039062, 52.052490 ], [ -92.021484, 52.052490 ] ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 2, "sovereignt": "Mexico", "sov_a3": "MEX", "adm0_dif": 0, "level": 2, "type": "Sovereign country", "admin": "Mexico", "adm0_a3": "MEX", "geou_dif": 0, "geounit": "Mexico", "gu_a3": "MEX", "su_dif": 0, "subunit": "Mexico", "su_a3": "MEX", "brk_diff": 0, "name": "Mexico", "name_long": "Mexico", "brk_a3": "MEX", "brk_name": "Mexico", "abbrev": "Mex.", "postal": "MX", "formal_en": "United Mexican States", "name_sort": "Mexico", "mapcolor7": 6, "mapcolor8": 1, "mapcolor9": 7, "mapcolor13": 3, "pop_est": 111211789, "gdp_md_est": 1563000, "pop_year": -99, "lastcensus": 2010, "gdp_year": -99, "economy": "4. Emerging region: MIKT", "income_grp": "3. Upper middle income", "wikipedia": -99, "iso_a2": "MX", "iso_a3": "MEX", "iso_n3": "484", "un_a3": "484", "wb_a2": "MX", "wb_a3": "MEX", "woe_id": -99, "adm0_a3_is": "MEX", "adm0_a3_us": "MEX", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "North America", "region_un": "Americas", "subregion": "Central America", "region_wb": "Latin America & Caribbean", "name_len": 6, "long_len": 6, "abbrev_len": 4, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -106.523438, 31.802893 ], [ -105.117188, 30.675715 ], [ -104.501953, 29.611670 ], [ -103.183594, 28.998532 ], [ -102.480469, 29.764377 ], [ -101.689453, 29.840644 ], [ -100.986328, 29.382175 ], [ -100.458984, 28.767659 ], [ -100.195312, 28.149503 ], [ -99.580078, 27.605671 ], [ -99.404297, 27.059126 ], [ -110.039062, 27.059126 ], [ -110.039062, 31.353637 ], [ -108.281250, 31.353637 ], [ -108.281250, 31.802893 ], [ -106.523438, 31.802893 ] ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 1, "featurecla": "Admin-0 country", "labelrank": 2, "sovereignt": "United States of America", "sov_a3": "US1", "adm0_dif": 1, "level": 2, "type": "Country", "admin": "United States of America", "adm0_a3": "USA", "geou_dif": 0, "geounit": "United States of America", "gu_a3": "USA", "su_dif": 0, "subunit": "United States of America", "su_a3": "USA", "brk_diff": 0, "name": "United States", "name_long": "United States", "brk_a3": "USA", "brk_name": "United States", "abbrev": "U.S.A.", "postal": "US", "formal_en": "United States of America", "name_sort": "United States of America", "mapcolor7": 4, "mapcolor8": 5, "mapcolor9": 1, "mapcolor13": 1, "pop_est": 313973000, "gdp_md_est": 15094000, "pop_year": 0, "lastcensus": 2010, "gdp_year": 0, "economy": "1. Developed region: G7", "income_grp": "1. High income: OECD", "wikipedia": 0, "iso_a2": "US", "iso_a3": "USA", "iso_n3": "840", "un_a3": "840", "wb_a2": "US", "wb_a3": "USA", "woe_id": -99, "adm0_a3_is": "USA", "adm0_a3_us": "USA", "adm0_a3_un": -99, "adm0_a3_wb": -99, "continent": "North America", "region_un": "Americas", "subregion": "Northern America", "region_wb": "North America", "name_len": 13, "long_len": 13, "abbrev_len": 6, "tiny": -99, "homepart": 1 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -94.833984, 49.439557 ], [ -94.658203, 48.864715 ], [ -94.394531, 48.690960 ], [ -92.636719, 48.458352 ], [ -92.021484, 48.283193 ], [ -92.021484, 29.688053 ], [ -92.548828, 29.611670 ], [ -93.251953, 29.840644 ], [ -94.746094, 29.535230 ], [ -95.625000, 28.767659 ], [ -96.679688, 28.381735 ], [ -97.207031, 27.839076 ], [ -97.382812, 27.059126 ], [ -99.404297, 27.059126 ], [ -99.580078, 27.605671 ], [ -100.195312, 28.149503 ], [ -100.458984, 28.767659 ], [ -100.986328, 29.382175 ], [ -101.689453, 29.840644 ], [ -102.480469, 29.764377 ], [ -103.183594, 28.998532 ], [ -103.974609, 29.305561 ], [ -104.501953, 29.611670 ], [ -105.117188, 30.675715 ], [ -106.523438, 31.802893 ], [ -108.281250, 31.802893 ], [ -108.281250, 31.353637 ], [ -110.039062, 31.353637 ], [ -110.039062, 49.037868 ], [ -95.185547, 49.037868 ], [ -95.185547, 49.439557 ], [ -94.833984, 49.439557 ] ] ] } } +] } +] } +] } diff --git a/tests/ne_110m_admin_1_states_provinces_lines/out/-z0_--clip-bounding-box_-110,27,-92,52.json b/tests/ne_110m_admin_1_states_provinces_lines/out/-z0_--clip-bounding-box_-110,27,-92,52.json new file mode 100644 index 000000000..cf14e55e9 --- /dev/null +++ b/tests/ne_110m_admin_1_states_provinces_lines/out/-z0_--clip-bounding-box_-110,27,-92,52.json @@ -0,0 +1,88 @@ +{ "type": "FeatureCollection", "properties": { +"bounds": "-110.039063,29.764377,-92.021484,49.037868", +"center": "-92.021484,29.764377,0", +"description": "tests/ne_110m_admin_1_states_provinces_lines/out/-z0_--clip-bounding-box_-110,27,-92,52.json.check.mbtiles", +"format": "pbf", +"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"adm0_a3\": \"String\", \"adm0_name\": \"String\", \"featurecla\": \"String\", \"mapcolor13\": \"Number\", \"mapcolor9\": \"Number\", \"scalerank\": \"Number\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 36,\"geometry\": \"LineString\",\"attributeCount\": 6,\"attributes\": [{\"attribute\": \"adm0_a3\",\"count\": 1,\"type\": \"string\",\"values\": [\"USA\"]},{\"attribute\": \"adm0_name\",\"count\": 1,\"type\": \"string\",\"values\": [\"United States of America\"]},{\"attribute\": \"featurecla\",\"count\": 1,\"type\": \"string\",\"values\": [\"Admin-1 boundary\"]},{\"attribute\": \"mapcolor13\",\"count\": 1,\"type\": \"number\",\"values\": [1],\"min\": 1,\"max\": 1},{\"attribute\": \"mapcolor9\",\"count\": 1,\"type\": \"number\",\"values\": [1],\"min\": 1,\"max\": 1},{\"attribute\": \"scalerank\",\"count\": 1,\"type\": \"number\",\"values\": [2],\"min\": 2,\"max\": 2}]}]}}", +"maxzoom": "0", +"minzoom": "0", +"name": "tests/ne_110m_admin_1_states_provinces_lines/out/-z0_--clip-bounding-box_-110,27,-92,52.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": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -110.039062, 45.089036 ], [ -104.150391, 45.089036 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -110.039062, 41.046217 ], [ -109.072266, 41.046217 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.062500, 46.012224 ], [ -104.150391, 49.037868 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.062500, 46.012224 ], [ -104.150391, 45.089036 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.150391, 45.089036 ], [ -104.062500, 43.004647 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.062500, 41.046217 ], [ -109.072266, 41.046217 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.062500, 41.046217 ], [ -104.062500, 43.004647 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -104.062500, 46.012224 ], [ -96.591797, 46.073231 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -96.591797, 46.073231 ], [ -96.855469, 47.040182 ], [ -96.855469, 47.576526 ], [ -97.207031, 48.166085 ], [ -97.294922, 49.037868 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -96.503906, 42.553080 ], [ -96.767578, 42.553080 ], [ -96.767578, 42.682435 ], [ -97.294922, 42.875964 ], [ -97.998047, 42.811522 ], [ -98.613281, 43.004647 ], [ -104.062500, 43.004647 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -96.503906, 43.516689 ], [ -96.591797, 45.398450 ], [ -96.855469, 45.644768 ], [ -96.855469, 45.767523 ], [ -96.591797, 45.890008 ], [ -96.591797, 46.073231 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -96.503906, 42.553080 ], [ -96.679688, 42.747012 ], [ -96.503906, 43.068888 ], [ -96.503906, 43.516689 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -95.800781, 40.647304 ], [ -95.976562, 41.442726 ], [ -96.152344, 41.574361 ], [ -96.152344, 41.836828 ], [ -96.416016, 42.163403 ], [ -96.503906, 42.553080 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -92.021484, 44.402392 ], [ -92.812500, 44.777936 ], [ -92.724609, 45.521744 ], [ -92.900391, 45.706179 ], [ -92.812500, 45.890008 ], [ -92.285156, 46.134170 ], [ -92.285156, 46.679594 ], [ -92.021484, 46.739861 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -92.021484, 43.580391 ], [ -96.503906, 43.516689 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -109.072266, 37.020098 ], [ -109.072266, 41.046217 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -110.039062, 37.020098 ], [ -109.072266, 37.020098 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -109.072266, 37.020098 ], [ -109.072266, 31.353637 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -103.007812, 37.020098 ], [ -109.072266, 37.020098 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -102.128906, 40.044438 ], [ -102.128906, 41.046217 ], [ -104.062500, 41.046217 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -103.007812, 37.020098 ], [ -103.007812, 36.527295 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -102.128906, 37.020098 ], [ -102.128906, 40.044438 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -103.007812, 37.020098 ], [ -102.128906, 37.020098 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -103.007812, 36.527295 ], [ -103.007812, 32.026706 ], [ -106.699219, 32.026706 ], [ -106.523438, 31.802893 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -95.361328, 40.044438 ], [ -102.128906, 40.044438 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -94.658203, 37.020098 ], [ -102.128906, 37.020098 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -94.482422, 33.651208 ], [ -95.273438, 33.943360 ], [ -96.064453, 33.943360 ], [ -96.328125, 33.797409 ], [ -96.855469, 33.797409 ], [ -97.031250, 33.943360 ], [ -97.119141, 33.797409 ], [ -97.734375, 34.016242 ], [ -97.998047, 33.943360 ], [ -98.173828, 34.161818 ], [ -98.613281, 34.161818 ], [ -99.228516, 34.307144 ], [ -99.404297, 34.452218 ], [ -99.667969, 34.379713 ], [ -100.019531, 34.597042 ], [ -100.019531, 36.527295 ], [ -103.007812, 36.527295 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -95.361328, 40.044438 ], [ -95.800781, 40.647304 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -95.800781, 40.647304 ], [ -92.021484, 40.647304 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -95.361328, 40.044438 ], [ -95.009766, 39.909736 ], [ -95.097656, 39.571822 ], [ -94.921875, 39.300299 ], [ -94.658203, 39.164141 ], [ -94.658203, 37.020098 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -94.658203, 36.597889 ], [ -94.658203, 37.020098 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -94.482422, 33.651208 ], [ -94.482422, 35.532226 ], [ -94.658203, 36.597889 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -94.658203, 36.597889 ], [ -92.021484, 36.527295 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -94.482422, 33.651208 ], [ -94.042969, 33.651208 ], [ -94.130859, 33.063924 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -92.021484, 33.063924 ], [ -94.130859, 33.063924 ] ] } } +, +{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": "Admin-1 boundary", "adm0_a3": "USA", "adm0_name": "United States of America", "mapcolor9": 1, "mapcolor13": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ -94.130859, 33.063924 ], [ -94.042969, 31.952162 ], [ -93.867188, 31.877558 ], [ -93.515625, 31.128199 ], [ -93.779297, 30.372875 ], [ -93.691406, 30.145127 ], [ -93.955078, 29.840644 ], [ -93.867188, 29.764377 ] ] } } +] } +] } +] } diff --git a/tests/ne_110m_populated_places/out/-z0_--clip-bounding-box_-110,27,-92,52.json b/tests/ne_110m_populated_places/out/-z0_--clip-bounding-box_-110,27,-92,52.json new file mode 100644 index 000000000..f570b7dbf --- /dev/null +++ b/tests/ne_110m_populated_places/out/-z0_--clip-bounding-box_-110,27,-92,52.json @@ -0,0 +1,20 @@ +{ "type": "FeatureCollection", "properties": { +"bounds": "-105.029297,29.840644,-95.361328,39.774769", +"center": "-95.361328,29.840644,0", +"description": "tests/ne_110m_populated_places/out/-z0_--clip-bounding-box_-110,27,-92,52.json.check.mbtiles", +"format": "pbf", +"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {\"ADM0CAP\": \"Number\", \"ADM0NAME\": \"String\", \"ADM0_A3\": \"String\", \"ADM1NAME\": \"String\", \"ADMIN1_COD\": \"Number\", \"CAPALT\": \"Number\", \"CHANGED\": \"Number\", \"CHECKME\": \"Number\", \"CITYALT\": \"String\", \"COMPARE\": \"Number\", \"DIFFASCII\": \"Number\", \"DIFFNOTE\": \"String\", \"ELEVATION\": \"Number\", \"FEATURECLA\": \"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\", \"UN_ADM0\": \"String\", \"UN_FID\": \"Number\", \"UN_LAT\": \"Number\", \"UN_LONG\": \"Number\", \"WORLDCITY\": \"Number\"} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"in\",\"count\": 2,\"geometry\": \"Point\",\"attributeCount\": 86,\"attributes\": [{\"attribute\": \"ADM0CAP\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"ADM0NAME\",\"count\": 1,\"type\": \"string\",\"values\": [\"United States of America\"]},{\"attribute\": \"ADM0_A3\",\"count\": 1,\"type\": \"string\",\"values\": [\"USA\"]},{\"attribute\": \"ADM1NAME\",\"count\": 2,\"type\": \"string\",\"values\": [\"Colorado\",\"Texas\"]},{\"attribute\": \"ADMIN1_COD\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"CAPALT\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"CHANGED\",\"count\": 1,\"type\": \"number\",\"values\": [5],\"min\": 5,\"max\": 5},{\"attribute\": \"CHECKME\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"CITYALT\",\"count\": 1,\"type\": \"string\",\"values\": [\"Denver\"]},{\"attribute\": \"COMPARE\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"DIFFASCII\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"DIFFNOTE\",\"count\": 1,\"type\": \"string\",\"values\": [\"Changed scale rank.\"]},{\"attribute\": \"ELEVATION\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"FEATURECLA\",\"count\": 2,\"type\": \"string\",\"values\": [\"Admin-1 capital\",\"Populated place\"]},{\"attribute\": \"GEONAMEID\",\"count\": 2,\"type\": \"number\",\"values\": [4699066,5419384],\"min\": 4699066,\"max\": 5419384},{\"attribute\": \"GEONAMESNO\",\"count\": 1,\"type\": \"string\",\"values\": [\"GeoNames match general + researched.\"]},{\"attribute\": \"GN_ASCII\",\"count\": 2,\"type\": \"string\",\"values\": [\"Denver\",\"Houston\"]},{\"attribute\": \"GN_POP\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"GTOPO30\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"ISO_A2\",\"count\": 1,\"type\": \"string\",\"values\": [\"US\"]},{\"attribute\": \"LABELRANK\",\"count\": 1,\"type\": \"number\",\"values\": [1],\"min\": 1,\"max\": 1},{\"attribute\": \"LATITUDE\",\"count\": 2,\"type\": \"number\",\"values\": [29.819974,39.739188],\"min\": 29.819974,\"max\": 39.739188},{\"attribute\": \"LONGITUDE\",\"count\": 2,\"type\": \"number\",\"values\": [-104.984016,-95.339979],\"min\": -104.984016,\"max\": -95.339979},{\"attribute\": \"LS_MATCH\",\"count\": 1,\"type\": \"number\",\"values\": [1],\"min\": 1,\"max\": 1},{\"attribute\": \"LS_NAME\",\"count\": 2,\"type\": \"string\",\"values\": [\"Denver\",\"Houston\"]},{\"attribute\": \"MAX_AREAKM\",\"count\": 2,\"type\": \"number\",\"values\": [1345,3041],\"min\": 1345,\"max\": 3041},{\"attribute\": \"MAX_AREAMI\",\"count\": 2,\"type\": \"number\",\"values\": [1174,519],\"min\": 519,\"max\": 1174},{\"attribute\": \"MAX_BBXMAX\",\"count\": 2,\"type\": \"number\",\"values\": [-104.708333,-95],\"min\": -104.708333,\"max\": -95},{\"attribute\": \"MAX_BBXMIN\",\"count\": 2,\"type\": \"number\",\"values\": [-105.241667,-95.841667],\"min\": -105.241667,\"max\": -95.841667},{\"attribute\": \"MAX_BBYMAX\",\"count\": 2,\"type\": \"number\",\"values\": [30.266667,40.025],\"min\": 30.266667,\"max\": 40.025},{\"attribute\": \"MAX_BBYMIN\",\"count\": 2,\"type\": \"number\",\"values\": [29.491667,39.5],\"min\": 29.491667,\"max\": 39.5},{\"attribute\": \"MAX_NATSCA\",\"count\": 1,\"type\": \"number\",\"values\": [100],\"min\": 100,\"max\": 100},{\"attribute\": \"MAX_PERKM\",\"count\": 2,\"type\": \"number\",\"values\": [1773,606],\"min\": 606,\"max\": 1773},{\"attribute\": \"MAX_PERMI\",\"count\": 2,\"type\": \"number\",\"values\": [1101,376],\"min\": 376,\"max\": 1101},{\"attribute\": \"MAX_POP10\",\"count\": 2,\"type\": \"number\",\"values\": [1548599,3647574],\"min\": 1548599,\"max\": 3647574},{\"attribute\": \"MAX_POP20\",\"count\": 2,\"type\": \"number\",\"values\": [2100407,4287078],\"min\": 2100407,\"max\": 4287078},{\"attribute\": \"MAX_POP300\",\"count\": 2,\"type\": \"number\",\"values\": [2174327,4352341],\"min\": 2174327,\"max\": 4352341},{\"attribute\": \"MAX_POP310\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"MAX_POP50\",\"count\": 2,\"type\": \"number\",\"values\": [2174327,4352341],\"min\": 2174327,\"max\": 4352341},{\"attribute\": \"MEAN_BBXC\",\"count\": 2,\"type\": \"number\",\"values\": [-104.993967,-95.431928],\"min\": -104.993967,\"max\": -95.431928},{\"attribute\": \"MEAN_BBYC\",\"count\": 2,\"type\": \"number\",\"values\": [29.810477,39.72985],\"min\": 29.810477,\"max\": 39.72985},{\"attribute\": \"MEGACITY\",\"count\": 1,\"type\": \"number\",\"values\": [1],\"min\": 1,\"max\": 1},{\"attribute\": \"MEGANAME\",\"count\": 2,\"type\": \"string\",\"values\": [\"Denver-Aurora\",\"Houston\"]},{\"attribute\": \"MIN_AREAKM\",\"count\": 2,\"type\": \"number\",\"values\": [2388,909],\"min\": 909,\"max\": 2388},{\"attribute\": \"MIN_AREAMI\",\"count\": 2,\"type\": \"number\",\"values\": [351,922],\"min\": 351,\"max\": 922},{\"attribute\": \"MIN_BBXMAX\",\"count\": 2,\"type\": \"number\",\"values\": [-104.866667,-95.133333],\"min\": -104.866667,\"max\": -95.133333},{\"attribute\": \"MIN_BBXMIN\",\"count\": 2,\"type\": \"number\",\"values\": [-105.241667,-95.841667],\"min\": -105.241667,\"max\": -95.841667},{\"attribute\": \"MIN_BBYMAX\",\"count\": 2,\"type\": \"number\",\"values\": [30.258915,39.958333],\"min\": 30.258915,\"max\": 39.958333},{\"attribute\": \"MIN_BBYMIN\",\"count\": 2,\"type\": \"number\",\"values\": [29.475,39.5],\"min\": 29.475,\"max\": 39.5},{\"attribute\": \"MIN_PERKM\",\"count\": 2,\"type\": \"number\",\"values\": [1257,371],\"min\": 371,\"max\": 1257},{\"attribute\": \"MIN_PERMI\",\"count\": 2,\"type\": \"number\",\"values\": [231,781],\"min\": 231,\"max\": 781},{\"attribute\": \"NAME\",\"count\": 2,\"type\": \"string\",\"values\": [\"Denver\",\"Houston\"]},{\"attribute\": \"NAMEALT\",\"count\": 1,\"type\": \"string\",\"values\": [\"Denver-Aurora\"]},{\"attribute\": \"NAMEASCII\",\"count\": 2,\"type\": \"string\",\"values\": [\"Denver\",\"Houston\"]},{\"attribute\": \"NAMEDIFF\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0},{\"attribute\": \"NATSCALE\",\"count\": 1,\"type\": \"number\",\"values\": [300],\"min\": 300,\"max\": 300},{\"attribute\": \"POP1950\",\"count\": 2,\"type\": \"number\",\"values\": [505,709],\"min\": 505,\"max\": 709},{\"attribute\": \"POP1955\",\"count\": 2,\"type\": \"number\",\"values\": [641,904],\"min\": 641,\"max\": 904},{\"attribute\": \"POP1960\",\"count\": 2,\"type\": \"number\",\"values\": [1151,809],\"min\": 809,\"max\": 1151},{\"attribute\": \"POP1965\",\"count\": 2,\"type\": \"number\",\"values\": [1396,923],\"min\": 923,\"max\": 1396},{\"attribute\": \"POP1970\",\"count\": 2,\"type\": \"number\",\"values\": [1054,1693],\"min\": 1054,\"max\": 1693},{\"attribute\": \"POP1975\",\"count\": 2,\"type\": \"number\",\"values\": [1198,2030],\"min\": 1198,\"max\": 2030},{\"attribute\": \"POP1980\",\"count\": 2,\"type\": \"number\",\"values\": [1356,2424],\"min\": 1356,\"max\": 2424},{\"attribute\": \"POP1985\",\"count\": 2,\"type\": \"number\",\"values\": [1437,2658],\"min\": 1437,\"max\": 2658},{\"attribute\": \"POP1990\",\"count\": 2,\"type\": \"number\",\"values\": [1528,2922],\"min\": 1528,\"max\": 2922},{\"attribute\": \"POP1995\",\"count\": 2,\"type\": \"number\",\"values\": [1747,3353],\"min\": 1747,\"max\": 3353},{\"attribute\": \"POP2000\",\"count\": 2,\"type\": \"number\",\"values\": [1998,3849],\"min\": 1998,\"max\": 3849},{\"attribute\": \"POP2005\",\"count\": 2,\"type\": \"number\",\"values\": [2241,4324],\"min\": 2241,\"max\": 4324},{\"attribute\": \"POP2010\",\"count\": 2,\"type\": \"number\",\"values\": [2313,4459],\"min\": 2313,\"max\": 4459},{\"attribute\": \"POP2015\",\"count\": 2,\"type\": \"number\",\"values\": [2396,4609],\"min\": 2396,\"max\": 4609},{\"attribute\": \"POP2020\",\"count\": 2,\"type\": \"number\",\"values\": [2502,4790],\"min\": 2502,\"max\": 4790},{\"attribute\": \"POP2025\",\"count\": 2,\"type\": \"number\",\"values\": [2590,4936],\"min\": 2590,\"max\": 4936},{\"attribute\": \"POP2050\",\"count\": 2,\"type\": \"number\",\"values\": [2661,5049],\"min\": 2661,\"max\": 5049},{\"attribute\": \"POP_MAX\",\"count\": 2,\"type\": \"number\",\"values\": [2313000,4459000],\"min\": 2313000,\"max\": 4459000},{\"attribute\": \"POP_MIN\",\"count\": 2,\"type\": \"number\",\"values\": [1548599,3647574],\"min\": 1548599,\"max\": 3647574},{\"attribute\": \"POP_OTHER\",\"count\": 2,\"type\": \"number\",\"values\": [1521278,3607616],\"min\": 1521278,\"max\": 3607616},{\"attribute\": \"RANK_MAX\",\"count\": 1,\"type\": \"number\",\"values\": [12],\"min\": 12,\"max\": 12},{\"attribute\": \"RANK_MIN\",\"count\": 1,\"type\": \"number\",\"values\": [12],\"min\": 12,\"max\": 12},{\"attribute\": \"SCALERANK\",\"count\": 1,\"type\": \"number\",\"values\": [1],\"min\": 1,\"max\": 1},{\"attribute\": \"SOV0NAME\",\"count\": 1,\"type\": \"string\",\"values\": [\"United States\"]},{\"attribute\": \"SOV_A3\",\"count\": 1,\"type\": \"string\",\"values\": [\"USA\"]},{\"attribute\": \"UN_ADM0\",\"count\": 1,\"type\": \"string\",\"values\": [\"United States of America\"]},{\"attribute\": \"UN_FID\",\"count\": 2,\"type\": \"number\",\"values\": [537,542],\"min\": 537,\"max\": 542},{\"attribute\": \"UN_LAT\",\"count\": 2,\"type\": \"number\",\"values\": [29.77,39.57],\"min\": 29.77,\"max\": 39.57},{\"attribute\": \"UN_LONG\",\"count\": 2,\"type\": \"number\",\"values\": [-105.07,-95.4],\"min\": -105.07,\"max\": -95.4},{\"attribute\": \"WORLDCITY\",\"count\": 1,\"type\": \"number\",\"values\": [0],\"min\": 0,\"max\": 0}]}]}}", +"maxzoom": "0", +"minzoom": "0", +"name": "tests/ne_110m_populated_places/out/-z0_--clip-bounding-box_-110,27,-92,52.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": { "SCALERANK": 1, "NATSCALE": 300, "LABELRANK": 1, "FEATURECLA": "Admin-1 capital", "NAME": "Denver", "NAMEALT": "Denver-Aurora", "DIFFASCII": 0, "NAMEASCII": "Denver", "ADM0CAP": 0, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "United States", "SOV_A3": "USA", "ADM0NAME": "United States of America", "ADM0_A3": "USA", "ADM1NAME": "Colorado", "ISO_A2": "US", "LATITUDE": 39.739188, "LONGITUDE": -104.984016, "CHANGED": 5, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 2313000, "POP_MIN": 1548599, "POP_OTHER": 1521278, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 5419384, "MEGANAME": "Denver-Aurora", "LS_NAME": "Denver", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 1548599, "MAX_POP20": 2100407, "MAX_POP50": 2174327, "MAX_POP300": 2174327, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 909, "MAX_AREAKM": 1345, "MIN_AREAMI": 351, "MAX_AREAMI": 519, "MIN_PERKM": 371, "MAX_PERKM": 606, "MIN_PERMI": 231, "MAX_PERMI": 376, "MIN_BBXMIN": -105.241667, "MAX_BBXMIN": -105.241667, "MIN_BBXMAX": -104.866667, "MAX_BBXMAX": -104.708333, "MIN_BBYMIN": 39.5, "MAX_BBYMIN": 39.5, "MIN_BBYMAX": 39.958333, "MAX_BBYMAX": 40.025, "MEAN_BBXC": -104.993967, "MEAN_BBYC": 39.72985, "COMPARE": 0, "GN_ASCII": "Denver", "ADMIN1_COD": 0, "GN_POP": 0, "ELEVATION": 0, "GTOPO30": 0, "GEONAMESNO": "GeoNames match general + researched.", "UN_FID": 537, "UN_ADM0": "United States of America", "UN_LAT": 39.57, "UN_LONG": -105.07, "POP1950": 505, "POP1955": 641, "POP1960": 809, "POP1965": 923, "POP1970": 1054, "POP1975": 1198, "POP1980": 1356, "POP1985": 1437, "POP1990": 1528, "POP1995": 1747, "POP2000": 1998, "POP2005": 2241, "POP2010": 2313, "POP2015": 2396, "POP2020": 2502, "POP2025": 2590, "POP2050": 2661, "CITYALT": "Denver" }, "geometry": { "type": "Point", "coordinates": [ -105.029297, 39.774769 ] } } +, +{ "type": "Feature", "properties": { "SCALERANK": 1, "NATSCALE": 300, "LABELRANK": 1, "FEATURECLA": "Populated place", "NAME": "Houston", "DIFFASCII": 0, "NAMEASCII": "Houston", "ADM0CAP": 0, "CAPALT": 0, "WORLDCITY": 0, "MEGACITY": 1, "SOV0NAME": "United States", "SOV_A3": "USA", "ADM0NAME": "United States of America", "ADM0_A3": "USA", "ADM1NAME": "Texas", "ISO_A2": "US", "LATITUDE": 29.819974, "LONGITUDE": -95.339979, "CHANGED": 5, "NAMEDIFF": 0, "DIFFNOTE": "Changed scale rank.", "POP_MAX": 4459000, "POP_MIN": 3647574, "POP_OTHER": 3607616, "RANK_MAX": 12, "RANK_MIN": 12, "GEONAMEID": 4699066, "MEGANAME": "Houston", "LS_NAME": "Houston", "LS_MATCH": 1, "CHECKME": 0, "MAX_POP10": 3647574, "MAX_POP20": 4287078, "MAX_POP50": 4352341, "MAX_POP300": 4352341, "MAX_POP310": 0, "MAX_NATSCA": 100, "MIN_AREAKM": 2388, "MAX_AREAKM": 3041, "MIN_AREAMI": 922, "MAX_AREAMI": 1174, "MIN_PERKM": 1257, "MAX_PERKM": 1773, "MIN_PERMI": 781, "MAX_PERMI": 1101, "MIN_BBXMIN": -95.841667, "MAX_BBXMIN": -95.841667, "MIN_BBXMAX": -95.133333, "MAX_BBXMAX": -95, "MIN_BBYMIN": 29.475, "MAX_BBYMIN": 29.491667, "MIN_BBYMAX": 30.258915, "MAX_BBYMAX": 30.266667, "MEAN_BBXC": -95.431928, "MEAN_BBYC": 29.810477, "COMPARE": 0, "GN_ASCII": "Houston", "ADMIN1_COD": 0, "GN_POP": 0, "ELEVATION": 0, "GTOPO30": 0, "GEONAMESNO": "GeoNames match general + researched.", "UN_FID": 542, "UN_ADM0": "United States of America", "UN_LAT": 29.77, "UN_LONG": -95.4, "POP1950": 709, "POP1955": 904, "POP1960": 1151, "POP1965": 1396, "POP1970": 1693, "POP1975": 2030, "POP1980": 2424, "POP1985": 2658, "POP1990": 2922, "POP1995": 3353, "POP2000": 3849, "POP2005": 4324, "POP2010": 4459, "POP2015": 4609, "POP2020": 4790, "POP2025": 4936, "POP2050": 5049 }, "geometry": { "type": "Point", "coordinates": [ -95.361328, 29.840644 ] } } +] } +] } +] } diff --git a/tile.cpp b/tile.cpp index e3173e146..23be1c780 100644 --- a/tile.cpp +++ b/tile.cpp @@ -2246,7 +2246,7 @@ long long write_tile(FILE *geoms, std::atomic *geompos_in, char *meta tile.layers = filter_layers(postfilter, tile.layers, z, tx, ty, layermaps, tiling_seg, layer_unmaps, 1 << line_detail); } - if (z == 0 && unclipped_features < original_features / 2) { + if (z == 0 && unclipped_features < original_features / 2 && clipbboxes.size() == 0) { fprintf(stderr, "\n\nMore than half the features were clipped away at zoom level 0.\n"); fprintf(stderr, "Is your data in the wrong projection? It should be in WGS84/EPSG:4326.\n"); } diff --git a/version.hpp b/version.hpp index 5589f67b1..bff73004f 100644 --- a/version.hpp +++ b/version.hpp @@ -1,6 +1,6 @@ #ifndef VERSION_HPP #define VERSION_HPP -#define VERSION "v1.32.0" +#define VERSION "v1.32.1" #endif