google / earthenterprise

Google Earth Enterprise - Open Source
Apache License 2.0
2.67k stars 889 forks source link

Issue #1785: Fix imagery project transparency #1836

Closed tst-lsavoie closed 4 years ago

tst-lsavoie commented 4 years ago

Fixes #1785

Thanks to @duvifn for discovering the problem and suggesting a solution.

The problem:

Fusion caches alpha bands to make building multiple layers more efficient. However, it checks for the existence of the alpha band before using it because 4.x did not cache alpha. This is a problem because sometimes the check for the cached alpha happens before it has been built, so Fusion incorrectly decides that there is no alpha and does not apply transparency correctly.

The fix:

This PR moves the check for the cached alpha folder to just before it is used so that it has time to build it if it needs to.

To verify:

  1. Create a flat 2D database containing only blue marble and publish it with WMS enabled.
  2. Create a flat 2D database containing only this file: https://drive.google.com/file/d/1IWjQvGDgGNRlGRVuRNImyfuAazGXN6xm/view?usp=sharing and no blue marble. It is important that the imagery resource and project are brand new and have not been built before.
  3. View both databases in a tool like QGIS with the clipped file on top of blue marble. You should see a small amount of high resolution imagery in San Francisco and blue marble everywhere else. Without this fix, the clipped image would have an opaque background and you would not see blue marble at all.
tst-lsavoie commented 4 years ago

@duvifn do you have time to review and test this PR? If you are happy with the code and it passes your tests, you can click on the "Files Changed" tab above, then on "Review Changes" at the top right and approve the PR.

FYI, I'm going to be unavailable for the next few days but will come back to this mid next week.

duvifn commented 4 years ago

@tst-lsavoie Thanks! This looks good to me and also tested with the given use case.

duvifn commented 4 years ago

I also checked this with multi layer project (bluemarble + clipped raster) to ensure that regular blending still works.

tst-lsavoie commented 4 years ago

I've run a number of tests on this and everything works as expected. No problems found.