I have a bunch of GeoTIFF files that I'm putting into an ImageMosaic in GeoServer. Each image corresponds to one day, and I have been able to successfully import the images into GeoServer such that I can indeed query for specific images via a WCS call using "cql_filter". The datafiles stored on the server have some metadata tags in them, including one that indicates the file's date. However, I have noticed that when I use WCS to get an image back, the metadata tags in the received file are different – the tags in the original file are not preserved.
Is there a way to configure GeoServer/ImageMosaic to cause it to write the value in the "timestamp" field of the database associated with the ImageMosaic into the file? The reason for this is that I've noticed that if no date value is specified (or if the query has a date value not matching an ingested image) that it will return an image, but it's not always clear exactly which image it is. Having the timestamp information in the file itself would make it clear what the date is for that file.
I posted this question on the GeoServer mailing list, and got an answer that I may need to use a WPS process, but I'm not sure if that will really help; if the file being passed into WPS has an "unknown" datetime, WPS won't be able to correctly add it. And I don't want the date from the query just blindly put into the file, as it may be a different date that is actually returned.
Any insight on this? I'm running GeoServer v2.15.0 (I know it's not the most recent, but upgrading may not be possible for the near future, though may happen sometime down the road).
Best Answer
That's currently not possible.
The GeoServer WCS code itself has no idea where the pixels are coming from, it's all hidden behind interfaces, GeoTIFF, NetCDF or ArcGrid all look the same. Data goes through an image processing chain before being encoded in the output format of choice, the information you're looking for is lost the moment that data is read from the source.
It is conceivable to preserve the original tiff tags, for cases when there is a single source image extracted from the mosaic, but it would require coding, at various level (at least GeoTools and GeoServer, maybe also imageio-ext). Check out this guide if you intend to make it happen: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-fixes,-improvements-and-new-features-in-GeoServer