Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong WMTS GetTile requests for some WMTS servers #7296

Open
keewis opened this issue Oct 24, 2024 · 1 comment
Open

wrong WMTS GetTile requests for some WMTS servers #7296

keewis opened this issue Oct 24, 2024 · 1 comment

Comments

@keewis
Copy link

keewis commented Oct 24, 2024

I'm trying to add tiles from this WMTS link to the terria instance at nationalmap.gov.au (share link)

While this allows me to see the list of available layers, adding a layer to the map does not actually display anything, and I see tile requests like

https://wmts.marine.copernicus.eu/teroWmts/NWSHELF_ANALYSISFORECAST_PHY_004_013/cmems_mod_nws_phy_anfc_0.027deg-3D_PT1H-m_202309?tilematrix=3&layer=NWSHELF_ANALYSISFORECAST_PHY_004_013/cmems_mod_nws_phy_anfc_0.027deg-3D_PT1H-m_202309/thetao&style=cmap:thermal&tilerow=2&tilecol=4&tilematrixset=EPSG:3857&format=image/png&service=WMTS&version=1.0.0&request=GetTile

failing with status code 400.

This server is a bit special in that in the response to GetCapabilities it requests using https://wmts.marine.copernicus.eu/teroWmts as the WMTS service endpoint for GetTile:

https://wmts.marine.copernicus.eu/teroWmts?tilematrix=3&layer=NWSHELF_ANALYSISFORECAST_PHY_004_013/cmems_mod_nws_phy_anfc_0.027deg-3D_PT1H-m_202309/thetao&style=cmap:thermal&tilerow=2&tilecol=4&tilematrixset=EPSG:3857&format=image/png&service=WMTS&version=1.0.0&request=GetTile

works as expected. However, this seems to be supported by the WMTS standard, as libraries like GDAL or owslib produce the right requests (I didn't read the standard text, though, so I may be wrong on that).

Would it be possible to fix that? I unfortunately don't know enough about JavaScript / TypeScript to open a PR myself.

cc @rsignell-usgs, @mdsumner

demonstration using the owslib.wmts python library
from owslib.wmts import WebMapTileService

url = "https://wmts.marine.copernicus.eu/teroWmts/NWSHELF_ANALYSISFORECAST_PHY_004_013/cmems_mod_nws_phy_anfc_0.027deg-3D_PT1H-m_202309?service=WMTS&request=GetCapabilities"

wmts = WebMapTileService(url)
response = wmts.gettile(
    layer="NWSHELF_ANALYSISFORECAST_PHY_004_013/cmems_mod_nws_phy_anfc_0.027deg-3D_PT1H-m_202309/thetao",
    tilematrixset="EPSG:3857",
    tilematrix="5",
    row=9,
    column=14,
    format="image/png",
)
print(response.geturl())
with open("test.png", mode="wb") as f:
    f.write(response.read())
@zoran995
Copy link
Contributor

zoran995 commented Dec 2, 2024

Hi @keevis thanks for reporting the bug.
After checking the specification this is definitely the bug in Terria's implementation of WMTS. According to the specification, we should respect the value defined in OperationsMetadata for GetTile and GetFeatureInfo. The operations metadata also specifies the encoding type of KVP or RESTFul and the KVP we can use directly but the RESTful doesn't specify the entire URL template so we have to fallback to layer ResourceURL. There is also part of the specification that specifies POST request but I don't think this is of interest for terria implementation as most of WMTS support either KVP or REST format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants