File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -204,15 +204,22 @@ function _computeImagePyramid ({ metadata }) {
204204 ( totalPixelMatrixColumns * pixelSpacing [ 1 ] ) . toFixed ( 4 ) ,
205205 ( totalPixelMatrixRows * pixelSpacing [ 0 ] ) . toFixed ( 4 )
206206 ] )
207+ let zoomFactor = baseTotalPixelMatrixColumns / totalPixelMatrixColumns
208+ const roundedZoomFactor = Math . round ( zoomFactor )
207209 /*
208210 * Compute the resolution at each pyramid level, since the zoom
209211 * factor may not be the same between adjacent pyramid levels.
212+ *
213+ * Round is conditional to avoid openlayers resolutions error.
214+ * The resolutions array should be composed of unique values in descending order.
210215 */
211- const zoomFactor = Math . round (
212- baseTotalPixelMatrixColumns / totalPixelMatrixColumns
213- )
216+ if ( pyramidResolutions . includes ( roundedZoomFactor ) ) {
217+ console . warn ( 'resolution conflict rounding zoom factor (baseTotalPixelMatrixColumns / totalPixelMatrixColumns): ' , zoomFactor )
218+ zoomFactor = parseFloat ( zoomFactor . toFixed ( 2 ) )
219+ } else {
220+ zoomFactor = roundedZoomFactor
221+ }
214222 pyramidResolutions . push ( zoomFactor )
215-
216223 pyramidOrigins . push ( offset )
217224 }
218225 pyramidResolutions . reverse ( )
You can’t perform that action at this time.
0 commit comments