Skip to content

Commit

Permalink
modifying check to resemble docstring, adding is_quadtree check to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan McCarthy committed Feb 8, 2024
1 parent 1deb214 commit 6854aa4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion morecantile/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6854aa4

Please sign in to comment.