sul-dlss / gis-robot-suite

Robots for GIS accessioning and delivery
Other
9 stars 4 forks source link

Create a transparency layer (alpha channel) for WGS84 derivative GeoTIFFs if one does not already exist #570

Open thatbudakguy opened 1 year ago

thatbudakguy commented 1 year ago

We have received feedback regarding the display of GeoTIFFs stored in our GeoServer instances.

3-Band raster data, those with 3 channels (R. G, B) display with a black box where pixels should be transparent.

Here is an example: https://earthworks.stanford.edu/catalog/stanford-bf278sn8784

Although the black border is not visible when data are downloaded and used in a GIS, it is visible when using the WMS/WFS feature.

The addition of an alpha channel (4th band) to the WGS84 derivative that is uploaded to GeoServer would make these pixels transparent.

Comment from Stace: This will likely require adding/altering a GDAL transformation to the robots? Should be pretty straightforward, but if we could use the Cloud-Optimized Geotiff driver in GDAL tfor the output, that would give us the added bonus of at least beginning to ingest compliant COGs, moving forward? https://gdal.org/drivers/raster/cog.html

This ticket has been reopened since we discovered the approach taken in #735 of using gdalwarp -dstalpha to add the alpha channel has several undesirable side effects:

Image

Is there a way to use gdal or some other tool to update the GeoTIFF such that it displays as desired in GeoServer? Or do we need to wait until we have moved to making Cloud Optimized GeoTIFFs for everything and access via GeoServer is deprecated?

thatbudakguy commented 1 year ago

While we're changing the robot behavior, worthwhile (as stace notes above) to start making COGs so that we can unblock https://github.com/sul-dlss/earthworks/issues/867 and use those COGs later on.

kimdurante commented 10 months ago

For some more context on this issue. This website is using our WMS/WFS services for georeferenced maps stored in SDR.

https://www.imaginedsanfrancisco.org/

The black borders were appearing, so they had to remediate the files to include an alpha channel.

edsu commented 10 months ago

It looks like the place to do this is in normalize_data since that's where other color manipulations are already happening? I'm assuming this new functionality doesn't warrant a new workflow step?

The GeoTIFF in bf278sn8784 referenced above is kinda huge (1 GB) so it would be nice to have a smaller one to test with.

justinlittman commented 10 months ago

Please note that I am in the midst of a significant refactor of Normalize Data robot.

edsu commented 10 months ago

@justinlittman thanks, are you removing the color normalization?

kimdurante commented 10 months ago

@edsu in the gis_workflow_data/fixtures folder: zx688yx4017 - is a GeoTIFF requiring an alpha channel (~181MB) vn977hm3834 - is a GeoTIFF containing an alpha channel

Hope that helps! I can add more if you need.

justinlittman commented 10 months ago

@edsu No, but the overall structure of the code will be much different.

kimdurante commented 10 months ago

@edsu added to gis_workflow_data/fixtures folder:

jk521jx4901 - Single band raster

qr891rz3640 - 3 band raster (73.5 MB)

edsu commented 9 months ago

I'm reopening this after discussion with @kimdurante, @jmartin-sul & @aaron-collier since the approach taken in #735 didn't work as desired. The initial description has been updated with information we learned.

jmartin-sul commented 8 months ago

from team planning discussion mon 2024-03-04, and follow up meeting tue 2024-03-12 with @kimdurante and @edsu:

[^1]: json_output['bands'][N]['colorInterpretation'] == 'Alpha' for any of the N bands in the JSON output, or Band \d Block=.* Type=.*, ColorInterp=Alpha if regexing the less structured output. e.g. { "bands": [{ "band": 1, ... }, ..., { "band":4, ..., "colorInterpretation":"Alpha" }] } or Band 4 Block=2673x128 Type=Byte, ColorInterp=Alpha

jmartin-sul commented 8 months ago

example of a large COG (cloud optimized GeoTIFF) that's run into trouble with various iterations of this work: https://argo-stage.stanford.edu/view/kg552qb0295