<div dir="ltr">For OpenAerialMap and various contract projects (including work with DEMs), I've formalized my COG generation settings in <a href="https://github.com/mojodna/marblecutter-tools">https://github.com/mojodna/marblecutter-tools</a>. <a href="https://github.com/mojodna/marblecutter-tools/blob/master/bin/transcode.sh">https://github.com/mojodna/marblecutter-tools/blob/master/bin/transcode.sh</a> does the bulk of the heavy lifting, so if you're curious, that's the script to check out. It's a total work in progress (yes, it needs a README ;-), so if anything jumps out at anyone as an obvious improvement, please let me know!<div><br></div><div>To summarize:</div><div><br></div><div>* block size (internal tiling) is 512x512</div><div>* sources are kept in their original CRS</div><div>* 4-band, 8-bit sources are assumed to be RGBA; band 4 (if present) is assumed to be an alpha channel and is extracted as the mask. RGB bands are converted to the YCbCr colorspace and JPEG-compressed w/ default quality settings. Pixel interleaving is used.</div><div>* floating-point sources are compressed using DEFLATE with a floating point predictor (3 for GDAL)</div><div>* all other sources are compressed using DEFLATE with a horizontal predictor (2 for GDAL)</div><div>* internal overviews are generated with the same settings and produced for factors of 2 until the overview is smaller than the block size (readers shouldn't gain much benefit beyond that even when rendering at very low resolutions)</div><div><br></div><div>BigTIFFs should be generated when necessary; since compression is in play, `BIGTIFF=IF_SAFER` is used (we added this recently after encountering a source within the threshold that GDAL's default heuristic didn't pick BigTIFF).</div><div><br></div><div>External masks (.msk sidecar) are currently created; this isn't ideal, but there were a couple driving reasons for doing this in the past (which may no longer be accurate, particularly after some recent improvements to rasterio):</div><div><br></div><div>* when read as masks by rasterio, [mask] overviews weren't used</div><div>* masks should be resampled using nearest-neighbor to preserve edge crispness, even when other resampling methods (lanczos, bicubic, etc) are used for imagery bands</div><div><br></div><div>I've compared data from Planet with re-transcoded sources using this pipeline; Planet's compression ratios are better, potentially because they use LZW rather than DEFLATE (and potentially a higher ZLEVEL; though I just changed that in marblecutter-tools).</div><div><br></div><div>seth</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 12, 2018 at 9:26 AM Chris Holmes <<a href="mailto:cholmes@planet.com">cholmes@planet.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">So one thing that many people new to COG wonder about is how well the different options perform. The spec leaves quite a bit open - compression, tile size, exact number of overviews, projection, etc. I know there's a lot of experience on this list, so I was wondering if people can share what is working well for them, including advanced optimizations that may be more specific to individual use cases, like serving web tiles or accessing large temporal stacks.</span><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">My hope is that from sharing these best practices we can start to get towards an idea of 'profiles' for COG's, or at least a set of solid recommendations for different use cases.</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">There's been some nice work done looking in to performance, in the original<span> </span><a href="https://trac.osgeo.org/gdal/wiki/CloudOptimizedGeoTIFF#Performancetesting" style="color:rgb(17,85,204)" target="_blank">COG wiki page</a>, and I also just came across this nice<span> </span><a href="https://github.com/opendatacube/benchmark-rio-s3/blob/master/report.md" style="color:rgb(17,85,204)" target="_blank">report</a><span> </span>from some<span> </span><a href="https://github.com/opendatacube/benchmark-rio-s3" style="color:rgb(17,85,204)" target="_blank">s3 gdal benchmarking tools</a> from opendatacube. If anyone has other good tools or reports please share them here, or just write up your experiences.</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">I'm also interested in comparisons to other formats (jp2k / mrf / ecw), along with tooling for performance testing (which we might gather in a repo), but I think I'll start another thread on this.</div><br></div>
_______________________________________________<br>
COG mailing list<br>
<a href="mailto:COG@lists.osgeo.org" target="_blank">COG@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/cog" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/cog</a><br>
</blockquote></div>