Open thatbudakguy opened 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.
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.
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.
Please note that I am in the midst of a significant refactor of Normalize Data robot.
@justinlittman thanks, are you removing the color normalization?
@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.
@edsu No, but the overall structure of the code will be much different.
@edsu added to gis_workflow_data/fixtures folder:
jk521jx4901 - Single band raster
qr891rz3640 - 3 band raster (73.5 MB)
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.
from team planning discussion mon 2024-03-04, and follow up meeting tue 2024-03-12 with @kimdurante and @edsu:
gdalinfo
?) and then only attempt to add one if one is not already present..vrt
) file; after which we pipe the virtual file output to gdal_translate
to create a compressed GeoTIFF derivative. see e.g. https://github.com/sul-dlss/gis-robot-suite/pull/799/commits/1a7998e1ba3eafa5270d84798f9e1ae4e203993d-dstnodata 0
flag on the gdalwarp
command (as in this commit)gdalinfo -nomd -json
called on file will list band info. only add alpha channel if input file already has exactly 3 bands, since 1 indicates grayscale, 4 indicates already has alpha. can maybe leave comment in code indicating that band will specifically say whether it's alpha[^1], and maybe the 3 band rule won't apply forever, but works for content we care about now.gdalwarp
generates a virtual file, and gdal_translate
turns that virtual file into a compressed GeoTIFF derivative with an added (but only if it was missing) alpha channel. see e.g. this commit.[^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
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
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: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?