mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 09:55:41 +02:00
Rationalize the highest allowed maxzoom in terms of detail
This commit is contained in:
@@ -750,7 +750,8 @@ int serialize_geometry(json_object *geometry, json_object *properties, const cha
|
|||||||
*/
|
*/
|
||||||
int feature_minzoom = 0;
|
int feature_minzoom = 0;
|
||||||
if (mb_geometry[t] == VT_LINE) {
|
if (mb_geometry[t] == VT_LINE) {
|
||||||
for (feature_minzoom = 0; feature_minzoom < 31; feature_minzoom++) {
|
// Skip z0 check because everything is always in the one z0 tile
|
||||||
|
for (feature_minzoom = 1; feature_minzoom < 31; feature_minzoom++) {
|
||||||
unsigned mask = 1 << (32 - (feature_minzoom + 1));
|
unsigned mask = 1 << (32 - (feature_minzoom + 1));
|
||||||
|
|
||||||
if (((bbox[0] & mask) != (bbox[2] & mask)) || ((bbox[1] & mask) != (bbox[3] & mask))) {
|
if (((bbox[0] & mask) != (bbox[2] & mask)) || ((bbox[1] & mask) != (bbox[3] & mask))) {
|
||||||
@@ -2774,6 +2775,21 @@ int main(int argc, char **argv) {
|
|||||||
files_open_at_start = open("/dev/null", O_RDONLY);
|
files_open_at_start = open("/dev/null", O_RDONLY);
|
||||||
close(files_open_at_start);
|
close(files_open_at_start);
|
||||||
|
|
||||||
|
if (full_detail <= 0) {
|
||||||
|
full_detail = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (full_detail < min_detail || low_detail < min_detail) {
|
||||||
|
fprintf(stderr, "%s: Full detail and low detail must be at least minimum detail\n", argv[0]);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need two checks: one for geometry representation, the other for
|
||||||
|
// index traversal when guessing base zoom and drop rate
|
||||||
|
if (maxzoom > 32 - full_detail) {
|
||||||
|
maxzoom = 32 - full_detail;
|
||||||
|
fprintf(stderr, "Highest supported zoom with detail %d is %d\n", full_detail, maxzoom);
|
||||||
|
}
|
||||||
if (maxzoom > MAX_ZOOM) {
|
if (maxzoom > MAX_ZOOM) {
|
||||||
maxzoom = MAX_ZOOM;
|
maxzoom = MAX_ZOOM;
|
||||||
fprintf(stderr, "Highest supported zoom is %d\n", maxzoom);
|
fprintf(stderr, "Highest supported zoom is %d\n", maxzoom);
|
||||||
@@ -2788,15 +2804,6 @@ int main(int argc, char **argv) {
|
|||||||
basezoom = maxzoom;
|
basezoom = maxzoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (full_detail <= 0) {
|
|
||||||
full_detail = 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (full_detail < min_detail || low_detail < min_detail) {
|
|
||||||
fprintf(stderr, "%s: Full detail and low detail must be at least minimum detail\n", argv[0]);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
geometry_scale = 32 - (full_detail + maxzoom);
|
geometry_scale = 32 - (full_detail + maxzoom);
|
||||||
if (geometry_scale < 0) {
|
if (geometry_scale < 0) {
|
||||||
geometry_scale = 0;
|
geometry_scale = 0;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{ "type": "FeatureCollection", "properties": {
|
{ "type": "FeatureCollection", "properties": {
|
||||||
"bounds": "-122.000000,37.000000,0.000000,51.500000",
|
"bounds": "-122.000000,37.000000,0.000000,51.500000",
|
||||||
"center": "-122.000000,37.000008,24",
|
"center": "-121.999912,37.000000,20",
|
||||||
"description": "tests/highzoom/out/-z30.json.check.mbtiles",
|
"description": "tests/highzoom/out/-z30.json.check.mbtiles",
|
||||||
"format": "pbf",
|
"format": "pbf",
|
||||||
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 24, \"fields\": {\"name\": \"String\"} } ] }",
|
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 20, \"fields\": {\"name\": \"String\"} } ] }",
|
||||||
"maxzoom": "24",
|
"maxzoom": "20",
|
||||||
"minzoom": "0",
|
"minzoom": "0",
|
||||||
"name": "tests/highzoom/out/-z30.json.check.mbtiles",
|
"name": "tests/highzoom/out/-z30.json.check.mbtiles",
|
||||||
"type": "overlay",
|
"type": "overlay",
|
||||||
@@ -369,76 +369,4 @@
|
|||||||
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 51.500000 ] } }
|
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 51.500000 ] } }
|
||||||
] }
|
] }
|
||||||
] }
|
] }
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 21, "x": 337874, "y": 816274 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "Santa Cruz" }, "geometry": { "type": "Point", "coordinates": [ -122.000084, 37.000085 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 21, "x": 1048575, "y": 697425 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ -0.000172, 51.500087 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 21, "x": 1048576, "y": 697425 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 51.500087 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 22, "x": 675748, "y": 1632549 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "Santa Cruz" }, "geometry": { "type": "Point", "coordinates": [ -122.000084, 37.000016 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 22, "x": 2097151, "y": 1394851 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ -0.000086, 51.500034 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 22, "x": 2097152, "y": 1394851 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 51.500034 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 23, "x": 1351497, "y": 3265098 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "Santa Cruz" }, "geometry": { "type": "Point", "coordinates": [ -122.000041, 37.000016 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 23, "x": 4194303, "y": 2789703 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ -0.000043, 51.500007 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 23, "x": 4194304, "y": 2789703 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 51.500007 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 24, "x": 2702995, "y": 6530196 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "Santa Cruz" }, "geometry": { "type": "Point", "coordinates": [ -122.000020, 37.000016 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 24, "x": 8388607, "y": 5579406 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ -0.000021, 51.500007 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
,
|
|
||||||
{ "type": "FeatureCollection", "properties": { "zoom": 24, "x": 8388608, "y": 5579406 }, "features": [
|
|
||||||
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
|
|
||||||
{ "type": "Feature", "properties": { "name": "London" }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 51.500007 ] } }
|
|
||||||
] }
|
|
||||||
] }
|
|
||||||
] }
|
] }
|
||||||
|
|||||||
Reference in New Issue
Block a user