<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi all,</div>
<p class="elementToProof" style="margin-top: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I would like to serve GeoTIFFs via GeoServer as WMS / WMTS. </p>
<p class="elementToProof" style="margin-top: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Basically, this is not a problem, but the GeoTIFFs should use as little disk space as possible while still being very performant when accessed via WMS.</p>
<p class="elementToProof" style="margin-top: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</p>
<p class="elementToProof" style="margin-top: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In the past, I worked with LZW compression, but the required storage space was quite large. </p>
<p class="elementToProof" style="margin-top: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
After making the disturbing white/black borders transparent and generating internal pyramids, the performance and visual quality were excellent—but the storage requirements became enormous.</p>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
So I referred to Paul Ramsey's article:<br>
<a href="https://blog.cleverelephant.ca/2015/02/geotiff-compression-for-dummies.html" target="_new" id="OWA45aec165-e603-d6e9-11f0-eac37f7ac7d0" class="OWAAutoLink" rel="noopener" data-start="590" data-end="665">https://blog.cleverelephant.ca/2015/02/geotiff-compression-for-dummies.html</a><br>
By using JPEG compression, I was able to reduce the storage requirement to about 1/6 of the original size, and the performance is still good.</div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
However, the problem is that I now get black artifacts around the edges when accessing the data via WMS.<br>
I suspect this is due to the JPEG compression.</div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In the ZIP archive linked below, you’ll find two screenshots showing the final result.</div>
<p class="elementToProof" style="margin-top: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The script I’m using is somewhat old (some excerpts are also included in the ZIP archive), so there might already be better ways to achieve this?</p>
<p class="elementToProof" style="margin-top: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
These are the steps I currently follow:</p>
<ul data-start="1241" data-end="1617">
<li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p class="elementToProof" style="margin-top: 0px;">Create a mosaic VRT with alpha band from all source data</p>
</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p class="elementToProof" style="margin-top: 0px;">Clip the mosaic VRT using a shapefile (to remove white/black borders) and transform it into the target coordinate system, using the 4th band (transparency) as a mask</p>
</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p style="margin-top: 0px;">Generate tiles with a size of 10,000 x 10,000 pixels</p>
</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p class="elementToProof" style="margin-top: 0px;">Compress the tiles</p>
</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p class="elementToProof" style="margin-top: 0px;">Generate internal pyramids</p>
</li></ul>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Am I overlooking something in my process?<br>
Do you have any ideas on how I can get rid of the artifacts while still keeping disk usage low?</div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://drive.google.com/file/d/1zRY2Xj8eJ-T7e9p3qp4HEknum0VJR81W/view?usp=sharing">https://drive.google.com/file/d/1zRY2Xj8eJ-T7e9p3qp4HEknum0VJR81W/view?usp=sharing</a></div>
<p class="elementToProof" style="margin-top: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best regards,</p>
<p class="elementToProof" style="margin-top: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Carsten</p>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
</body>
</html>