From 7800af830a5f56c2d9aba30d2fc925284253839b Mon Sep 17 00:00:00 2001 From: David Eagles Date: Fri, 24 Sep 2021 11:09:17 +1000 Subject: [PATCH] Modified WMTS Resource URL generation to support hostnames that contain the layer name. If the hostname contained the layer name (eg. https://layername.domain.com/layername/wmts) then the WMTS capabilities document contained an incorrect Resource URL because the hostname was stripped back to simply https://. This modification simply looks for the last occurrence of the layer name instead of the first when forming the Resource URL. --- tileserver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tileserver.php b/tileserver.php index 7397e01..d4e12d4 100755 --- a/tileserver.php +++ b/tileserver.php @@ -1031,7 +1031,7 @@ class Wmts extends Server { $maxMercatorZoom = max($maxMercatorZoom, $m['maxzoom']); } - $wmtsHost = substr($m['tiles'][0], 0, strpos($m['tiles'][0], $m['basename'])); + $wmtsHost = substr($m['tiles'][0], 0, strrpos($m['tiles'][0], $m['basename'])); $resourceUrlTemplate = $wmtsHost . $basename . '/{TileMatrix}/{TileCol}/{TileRow}'; if(strlen($format) <= 4){