From 7dd1998e2c5c58182c9db49271b70cac4eab5c9d Mon Sep 17 00:00:00 2001 From: peitili <62725319+peitili@users.noreply.github.com> Date: Fri, 3 Mar 2023 15:17:56 -0800 Subject: [PATCH] Move default max zoom 16 to a constants module (#389) * Move max zoom 16 to a constants module * bump version to v2.5.0 --------- Co-authored-by: Nathaniel Kelso Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- CHANGELOG.md | 2 +- VERSION | 2 +- tilequeue/command.py | 2 +- tilequeue/config.py | 3 ++- tilequeue/constants.py | 1 + tilequeue/process.py | 4 ++-- 6 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 tilequeue/constants.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e7920da..c1d29426 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ v2.5.0 * Add trimming of overzoom features from tiles where they're not needed (related to "max zoom" and overzooming, especially to drop address points in buildings layer and some kinds in the pois layer). [PR #402](https://github.com/tilezen/tilequeue/pull/402) * Add support for preprocessed inline geojson layers, paired with [vector-datasource/2095](https://github.com/tilezen/vector-datasource/pull/2095). [PR #414](https://github.com/tilezen/tilequeue/pull/414) * Set the MVT resolution (extent) to 4096 pixels instead of 8192 in most circumstances to save file size. [PR #404](https://github.com/tilezen/tilequeue/pull/404) +* Move default "max zoom" of 16 to a constants module. [PR #389](https://github.com/tilezen/tilequeue/pull/389) * Clarify with inline docs that "meters per pixel" assumes a 256-pixel nominal extent. [PR #408](https://github.com/tilezen/tilequeue/pull/408) * Add linters for YAML, JSON, and Python to the repo. [PR #403](https://github.com/tilezen/tilequeue/pull/403) * Update requirements.txt to pin boto3 and botocore to make it easier to assume an S3 role. [PR #416](https://github.com/tilezen/tilequeue/pull/416) @@ -24,7 +25,6 @@ v2.4.1-final * Add comma as character to put in quotes to smooth import of Who's On First neighbourhoods. [PR #400](https://github.com/tilezen/tilequeue/pull/400) * Add more logging for performance tuning. [PR #390](https://github.com/tilezen/tilequeue/pull/392) and others. - v2.4.0 ------ diff --git a/VERSION b/VERSION index 276cbf9e..437459cd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3.0 +2.5.0 diff --git a/tilequeue/command.py b/tilequeue/command.py index ebbe7859..d43f54c1 100755 --- a/tilequeue/command.py +++ b/tilequeue/command.py @@ -2159,7 +2159,7 @@ def tilequeue_meta_tile(cfg, args): 'Unexpected zoom: %s, zoom should be between %d and %d' % \ (coord_str, queue_zoom, group_by_zoom) - # NOTE: max_zoom looks to be inclusive + # NOTE: max_zoom looks to be inclusive but zoom_stop is exclusive so pay attention the confusing names here zoom_stop = cfg.max_zoom assert zoom_stop > group_by_zoom formats = lookup_formats(cfg.output_formats) diff --git a/tilequeue/config.py b/tilequeue/config.py index 3a68fa92..eff26fd2 100644 --- a/tilequeue/config.py +++ b/tilequeue/config.py @@ -2,6 +2,7 @@ from yaml import load +from tilequeue.constants import MAX_TILE_ZOOM from tilequeue.tile import bounds_buffer from tilequeue.tile import metatile_zoom_from_size @@ -337,7 +338,7 @@ def default_yml_config(): 'expired-location': None, 'parent-zoom-until': None, }, - 'max-zoom-with-changes': 16, + 'max-zoom-with-changes': MAX_TILE_ZOOM, }, 'toi-store': { 'type': None, diff --git a/tilequeue/constants.py b/tilequeue/constants.py new file mode 100644 index 00000000..b06893a5 --- /dev/null +++ b/tilequeue/constants.py @@ -0,0 +1 @@ +MAX_TILE_ZOOM = 16 # tilezen's default max supported zoom diff --git a/tilequeue/process.py b/tilequeue/process.py index 360f8373..26e03469 100644 --- a/tilequeue/process.py +++ b/tilequeue/process.py @@ -17,6 +17,7 @@ from tilequeue import utils from tilequeue.config import create_query_bounds_pad_fn +from tilequeue.constants import MAX_TILE_ZOOM from tilequeue.log import make_coord_dict from tilequeue.tile import calc_meters_per_pixel_dim from tilequeue.tile import coord_to_mercator_bounds @@ -389,8 +390,7 @@ def process_coord_no_format( assert min_zoom is not None, \ 'Missing min_zoom in layer %s' % layer_name - # TODO would be better if 16 wasn't hard coded here - if nominal_zoom < 16 and min_zoom >= nominal_zoom + 1: + if nominal_zoom < MAX_TILE_ZOOM and min_zoom >= nominal_zoom + 1: continue for k, v in output_props.items():