Merge pull request #12713 from tschaub/geotiff-crs

Check for GeoTIFF CRS starting with last image
This commit is contained in:
Tim Schaub
2021-09-06 16:05:02 -06:00
committed by GitHub
+8 -4
View File
@@ -416,13 +416,17 @@ class GeoTIFFSource extends DataTile {
} }
if (!this.getProjection()) { if (!this.getProjection()) {
const firstImage = sources[0][0]; const firstSource = sources[0];
if (firstImage.geoKeys) { for (let i = firstSource.length - 1; i >= 0; --i) {
const image = firstSource[i];
if (image.geoKeys) {
const code = const code =
firstImage.geoKeys.ProjectedCSTypeGeoKey || image.geoKeys.ProjectedCSTypeGeoKey ||
firstImage.geoKeys.GeographicTypeGeoKey; image.geoKeys.GeographicTypeGeoKey;
if (code) { if (code) {
this.projection = getProjection(`EPSG:${code}`); this.projection = getProjection(`EPSG:${code}`);
break;
}
} }
} }
} }