Skip to content

Commit

Permalink
use tms count from morecantile
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Aug 23, 2021
1 parent d4922fd commit 43223cb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Release Notes

## Next (TDB)

### titiler.core

- fix morecantile related tests (https://github.com/developmentseed/titiler/issues/358)

### titiler.application

- fix morecantile related tests (https://github.com/developmentseed/titiler/issues/358)

## 0.3.5 (2021-08-17)

### titiler.mosaic
Expand Down
8 changes: 7 additions & 1 deletion src/titiler/application/tests/routes/test_tms.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
"""test TileMatrixSets endpoints."""

import morecantile

NB_DEFAULT_TMS = len(morecantile.tms.list())


def test_tilematrix(app):
"""test /tileMatrixSet endpoint."""
response = app.get("/tileMatrixSets")
assert response.status_code == 200
body = response.json()
assert len(body["tileMatrixSets"]) == 12 # morecantile has 10 defaults
assert (
len(body["tileMatrixSets"]) == NB_DEFAULT_TMS + 2
) # morecantile defaults + 2 customs
tms = list(filter(lambda m: m["id"] == "EPSG3413", body["tileMatrixSets"]))[0]
assert tms["links"][0]["href"] == "http://testserver/tileMatrixSets/EPSG3413"

Expand Down
4 changes: 2 additions & 2 deletions src/titiler/application/titiler/application/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

# CUSTOM TMS for EPSG:3413
EPSG3413 = morecantile.TileMatrixSet.custom(
(-4194300, -4194300, 4194300, 4194300),
[-4194300, -4194300, 4194300, 4194300],
CRS.from_epsg(3413),
identifier="EPSG3413",
matrix_scale=[2, 2],
Expand All @@ -54,7 +54,7 @@
# CUSTOM TMS for EPSG:6933
# info from https://epsg.io/6933
EPSG6933 = morecantile.TileMatrixSet.custom(
(-17357881.81713629, -7324184.56362408, 17357881.81713629, 7324184.56362408),
[-17357881.81713629, -7324184.56362408, 17357881.81713629, 7324184.56362408],
CRS.from_epsg(6933),
identifier="EPSG6933",
matrix_scale=[1, 1],
Expand Down
4 changes: 3 additions & 1 deletion src/titiler/core/tests/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

from starlette.testclient import TestClient

NB_DEFAULT_TMS = len(morecantile.tms.list())


def test_TilerFactory():
"""Test TilerFactory class."""
Expand Down Expand Up @@ -671,7 +673,7 @@ def test_TMSFactory():
response = client.get("/tms/tileMatrixSets")
assert response.status_code == 200
body = response.json()
assert len(body["tileMatrixSets"]) == 10 # morecantile has 10 defaults
assert len(body["tileMatrixSets"]) == NB_DEFAULT_TMS
tms = list(filter(lambda m: m["id"] == "WebMercatorQuad", body["tileMatrixSets"]))[
0
]
Expand Down

0 comments on commit 43223cb

Please sign in to comment.