diff --git a/src/ol/source/GeoTIFF.js b/src/ol/source/GeoTIFF.js index 0ff3cb4a42..d1cd4378f8 100644 --- a/src/ol/source/GeoTIFF.js +++ b/src/ol/source/GeoTIFF.js @@ -416,13 +416,17 @@ class GeoTIFFSource extends DataTile { } if (!this.getProjection()) { - const firstImage = sources[0][0]; - if (firstImage.geoKeys) { - const code = - firstImage.geoKeys.ProjectedCSTypeGeoKey || - firstImage.geoKeys.GeographicTypeGeoKey; - if (code) { - this.projection = getProjection(`EPSG:${code}`); + const firstSource = sources[0]; + for (let i = firstSource.length - 1; i >= 0; --i) { + const image = firstSource[i]; + if (image.geoKeys) { + const code = + image.geoKeys.ProjectedCSTypeGeoKey || + image.geoKeys.GeographicTypeGeoKey; + if (code) { + this.projection = getProjection(`EPSG:${code}`); + break; + } } } }