✅ Validate COG#

localtileserver includes a helper method to validate whether or not a source image meets the requirements of a Cloud Optimized GeoTiff.

localtileserver.validate.validate_cog() uses rio-cogeo to validate whether or not a source image meets the requirements of a Cloud Optimized GeoTIFF.

You can use the script by:

from localtileserver import validate_cog

# Path to raster (URL or local path)
url = 'https://github.com/giswqs/data/raw/main/raster/landsat7.tif'

# If invalid, returns False
validate_cog(url)
True

This can also be used with an existing localtileserver.TileClient:

from localtileserver import examples, validate_cog

client = examples.get_san_francisco()

# If invalid, returns False
validate_cog(client)
True