Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
usedPipeline = usedPipeline || landsat8Pipeline;
} else {
bands = new Map(
files
.filter(file => /.TIFF?$/gi.test(file))
.map((file, i) => [i, file]),
);
}
const hasOvr = typeof files.find(file => /.TIFF?.OVR$/i.test(file)) !== 'undefined';
dispatch(
addScene(url, bands, red, green, blue, false, hasOvr, false, attribution, usedPipeline)
);
} else if (contentType === 'image/tiff') {
const tiff = await fromUrl(url);
const image = await tiff.getImage();
const samples = image.getSamplesPerPixel();
const bands = new Map();
for (let i = 0; i < samples; ++i) {
bands.set(i, url);
}
let [red, green, blue] = [];
if (samples === 3 || typeof image.fileDirectory.PhotometricInterpretation !== 'undefined') {
red = 0;
green = 1;
blue = 2;
} else {
red = 0;
green = 0;
async getImage(sceneId, url, hasOvr = true) {
if (!this.sceneSources[sceneId]) {
this.sceneSources[sceneId] = {};
}
if (!this.sceneSources[sceneId][url]) {
if (hasOvr) {
this.sceneSources[sceneId][url] = fromUrls(url, [`${url}.ovr`]);
} else {
this.sceneSources[sceneId][url] = fromUrl(url);
}
}
return this.sceneSources[sceneId][url];
}