(bounds, maxZoom = 22, tileSize = 512)
| 154 | * @returns {Array} resolutions |
| 155 | */ |
| 156 | export function extentToResolutions(bounds, maxZoom = 22, tileSize = 512) { |
| 157 | var resolutions = []; |
| 158 | var left = bounds.left; |
| 159 | var right = bounds.right; |
| 160 | if (Array.isArray(bounds)) { |
| 161 | left = bounds[0]; |
| 162 | right = bounds[2]; |
| 163 | } |
| 164 | const maxReolution = Math.abs(left - right) / tileSize; |
| 165 | for (let i = 0; i < maxZoom; i++) { |
| 166 | resolutions.push(maxReolution / Math.pow(2, i)); |
| 167 | } |
| 168 | return resolutions.sort(function (a, b) { |
| 169 | return b - a; |
| 170 | }); |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * @private |
no test coverage detected