Skip to content

Commit

Permalink
check project scales and replace scale 0 with scale 1
Browse files Browse the repository at this point in the history
  • Loading branch information
nworr committed Jul 31, 2023
1 parent 68ab410 commit f2fcfb6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lizmap/modules/lizmap/classes/lizmapTiler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ public static function getTileMatrixSetList($project, $wms_xml)
$rootExtent[3] = $geoExtent[3];
}

$scales = array_merge(array(), $project->getOption('mapScales'));
rsort($scales);

$scales = self::normalizeProjectScales($project);
$projection = $project->getOption('projection');

$tileMatrixSetList = array();
Expand Down Expand Up @@ -421,8 +419,7 @@ public static function getLayerTileInfo($layerName, $project, $wms_xml, $tileMat
$rootExtent[3] = $geoExtent[3];
}

$scales = array_merge(array(), $project->getOption('mapScales'));
rsort($scales);
$scales = self::normalizeProjectScales($project);

$layers = $project->getLayers();
$layer = $layers->{$layerName};
Expand Down Expand Up @@ -602,4 +599,15 @@ public static function getTileBbox($tileMatrixSet, $tileMatrixId, $tileRow, $til

return (string) $minx.','.(string) $miny.','.(string) $maxx.','.(string) $maxy;
}

private static function normalizeProjectScales($project)
{
$scales = array_merge(array(), $project->getOption('mapScales'));
if (reset($scales) == 0) {
$scales[0] = 1;
}
rsort($scales);

return $scales;
}
}

0 comments on commit f2fcfb6

Please sign in to comment.