watermarking all overviews in a geotiff #2978
-
I am a beginner with rasterio and GIS in general. Apologies if this gets a bit long winded! I have a series of digitised historical maps. This means we have 4 bands (RGBA). I want to watermark these maps. I remember seeing this on google maps a while ago actually, there was a copyright watermark pretty visible on the tiles. To get the desired effect I need to apply the watermark on each overview, tiled across the whole raster. And on each overview the size of the watermark would be the same (it wouldn't scale with the overview, as it needs to remain properly readable.) This means that after this operation the overview aren't strictly speaking overviews as they defacto contain different data and not just a scaled down version of the data. I suspect this isn't very usual in GIS. My (limited) understanding is that, while it is obvious to me to think of these 4 bands as the 4 color channels in an image, this is not necessarily how geotiffs work. (i.e. each band can be a measurement for anything that is measured in a raster.) Experimenting with gdal and rasterio in python, i managed to access the data of each overview, as a numpy array. I could then have an array for my watermark and modify the image itself. With gdal I can get the data for an overview like so: With rasterio I am less sure, Lastly, with both libraries I couldn't figure out how to write an overview. Am I misunderstanding how things work? Any leads on how I could watermark a GeoTIFF? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@gtnbssn you can't do this directly with rasterio/gdal because we can't write specific overview but this is something you will be able to do with https://github.com/airbusgeo/cogger https://gist.github.com/vincentsarago/9ece7981c4cd2da265e2175e858a1531 is an example of how I used it |
Beta Was this translation helpful? Give feedback.
-
@gtnbssn you can read a specific overview by passing an integer |
Beta Was this translation helpful? Give feedback.
@gtnbssn you can't do this directly with rasterio/gdal because we can't write specific overview but this is something you will be able to do with https://github.com/airbusgeo/cogger
https://gist.github.com/vincentsarago/9ece7981c4cd2da265e2175e858a1531 is an example of how I used it