mirror of
https://github.com/klokantech/tileserver-php.git
synced 2025-08-03 13:17:34 +02:00
Max zoom of Mercator TileMatrixSet is affected with max of layers maxzoom (closes #76)
This commit is contained in:
@@ -830,14 +830,15 @@ class Wmts extends Server {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Default TileMetrixSet for Pseudo Mercator projection 3857
|
* Default TileMetrixSet for Pseudo Mercator projection 3857
|
||||||
|
* @param ?number $maxZoom
|
||||||
* @return string TileMatrixSet xml
|
* @return string TileMatrixSet xml
|
||||||
*/
|
*/
|
||||||
public function getMercatorTileMatrixSet(){
|
public function getMercatorTileMatrixSet($maxZoom = 18){
|
||||||
$denominatorBase = 559082264.0287178;
|
$denominatorBase = 559082264.0287178;
|
||||||
$extent = array(-20037508.34,-20037508.34,20037508.34,20037508.34);
|
$extent = array(-20037508.34,-20037508.34,20037508.34,20037508.34);
|
||||||
$tileMatrixSet = array();
|
$tileMatrixSet = array();
|
||||||
|
|
||||||
for($i = 0; $i <= 18; $i++){
|
for($i = 0; $i <= $maxZoom; $i++){
|
||||||
$matrixSize = pow(2, $i);
|
$matrixSize = pow(2, $i);
|
||||||
$tileMatrixSet[] = array(
|
$tileMatrixSet[] = array(
|
||||||
'extent' => $extent,
|
'extent' => $extent,
|
||||||
@@ -1010,6 +1011,7 @@ class Wmts extends Server {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$tileMatrixSet = 'GoogleMapsCompatible';
|
$tileMatrixSet = 'GoogleMapsCompatible';
|
||||||
|
$maxMercatorZoom = max(18, $maxMercatorZoom, $m['maxzoom']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$wmtsHost = substr($m['tiles'][0], 0, strpos($m['tiles'][0], $m['basename']));
|
$wmtsHost = substr($m['tiles'][0], 0, strpos($m['tiles'][0], $m['basename']));
|
||||||
@@ -1044,7 +1046,7 @@ class Wmts extends Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Print PseudoMercator TileMatrixSet
|
// Print PseudoMercator TileMatrixSet
|
||||||
echo $this->getMercatorTileMatrixSet();
|
echo $this->getMercatorTileMatrixSet($maxMercatorZoom);
|
||||||
|
|
||||||
// Print WGS84 TileMatrixSet
|
// Print WGS84 TileMatrixSet
|
||||||
echo $this->getWGS84TileMatrixSet();
|
echo $this->getWGS84TileMatrixSet();
|
||||||
|
Reference in New Issue
Block a user