From 6854aa42c75b85d3c4628e6a43973538dd33bed9 Mon Sep 17 00:00:00 2001 From: Ryan McCarthy Date: Thu, 8 Feb 2024 10:09:36 -0700 Subject: [PATCH] modifying check to resemble docstring, adding is_quadtree check to tests --- morecantile/models.py | 2 +- tests/test_models.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/morecantile/models.py b/morecantile/models.py index a719a6a..1188958 100644 --- a/morecantile/models.py +++ b/morecantile/models.py @@ -716,7 +716,7 @@ def custom( transform = pyproj.Transformer.from_crs(extent_crs, crs, always_xy=True) extent = transform.transform_bounds(*extent, densify_pts=21) - if decimation_base < 2: + if decimation_base <= 1: raise ValueError( "Custom TileMatrixSet requires a decimation base that is greater than 1." ) diff --git a/tests/test_models.py b/tests/test_models.py index 3216253..28fc34b 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -195,6 +195,12 @@ def test_custom_tms_decimation(): pyproj.CRS.from_epsg(6342), decimation_base=decimation_base, ) + + if decimation_base == 2: + assert custom_tms.is_quadtree + else: + assert not custom_tms.is_quadtree + for zoom in [0, 1, 2, 3]: tile_width = (right - left) / decimation_base**zoom tile_height = (top - bottom) / decimation_base**zoom