Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/layer/AbstractLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ export class AbstractLayer {
fromTime: tiles[tileIndex].sensingTime,
toTime: tiles[tileIndex].sensingTime,
coveragePercent: 0,
meta: {},
meta: {
lowestCloudCoverPercent: tiles[tileIndex].meta.cloudCoverPercent,
},
};
currentFlyoverGeometry = tiles[tileIndex].geometry.coordinates as Geom;
sumCloudCoverPercent = tiles[tileIndex].meta.cloudCoverPercent;
Expand Down Expand Up @@ -344,7 +346,9 @@ export class AbstractLayer {
fromTime: tiles[tileIndex].sensingTime,
toTime: tiles[tileIndex].sensingTime,
coveragePercent: 0,
meta: {},
meta: {
lowestCloudCoverPercent: tiles[tileIndex].meta.cloudCoverPercent,
},
};
currentFlyoverGeometry = tiles[tileIndex].geometry.coordinates as Geom;
sumCloudCoverPercent = tiles[tileIndex].meta.cloudCoverPercent;
Expand All @@ -356,6 +360,12 @@ export class AbstractLayer {
this.roundCoordinates(currentFlyoverGeometry),
this.roundCoordinates(tiles[tileIndex].geometry.coordinates as Geom),
);

// update the lowest cloud cover:
if (tiles[tileIndex].meta.cloudCoverPercent < tiles[tileIndex - 1].meta.cloudCoverPercent) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check would be clearer if the comparison would be done against the saved value and not the value of the previous element

if (tiles[tileIndex].meta.cloudCoverPercent < flyovers[flyoverIndex].meta.lowestCloudCoverPercent) {
  ...
}

flyovers[flyoverIndex].meta.lowestCloudCoverPercent = tiles[tileIndex].meta.cloudCoverPercent;
}

sumCloudCoverPercent =
sumCloudCoverPercent !== undefined
? sumCloudCoverPercent + tiles[tileIndex].meta.cloudCoverPercent
Expand Down