[gdal-dev] Utilizing GDAL for adding overviews layer in python language

Idan Miara idan at miara.com
Tue Mar 12 01:44:44 PDT 2024


Hi,

You could use gdal to write a single tiff file from each numpy array layer
and name it accordingly:
base.tif - your input tiff file
base.tif.ovr - first overview
base.tif.ovr.ovr - second overview
base.tif.ovr.ovr.ovr - third overview
etc.

gdal would know to read these overviews automatically, but if you want you
can also transform base.tif (along with its new overviews) into a single
tif file with internal overviews (a COG could be a good choice).

There might be a way to write them all together into a single tiff in one
go without using intermediate single overview per layer files, but I'm not
sure how.


On Tue, 12 Mar 2024 at 10:28, Pradeep Mahato <pradeep.cabs at gov.in> wrote:

> Hi Idan,
>      We are using CuPy and CuCim to generate the pyramid layers, these
> layers are in numpy array format (LxWxHxC). Here L is number of pyramid
> layer and HxWxC is image in numpy array. Problem we are facing is that how
> to combine/stack these pyramid layers in one tiff file using GDAL.
>
> Thanks and Regards,
> Pradeep Kumar Mahato
> Phone: 080-2504 9199/ +91 8762020114
>
> ------------------------------
> *From: *idan at miara.com
> *To: *"Pradeep Mahato" <pradeep.cabs at gov.in>
> *Cc: *gdal-dev at lists.osgeo.org
> *Sent: *Tuesday, March 12, 2024 12:41:25 PM
> *Subject: *Re: [gdal-dev] Utilizing GDAL for adding overviews layer in
> python language
>
> Hi,
>
> So you are saying that you used gdal buildoverview in Python to add
> overviews to the tiff file but it only uses CPU and not GPU.
> And you could use the other library to add overviews using GPU - can you
> share which library you used or what's the output format that you got?
> Maybe you can combine the output of the other library into the tiff file
> using gdal in Python.
>
> Kind regards,
> Idan
>
>
> On Tue, 12 Mar 2024, 09:02 Pradeep Mahato via gdal-dev, <
> gdal-dev at lists.osgeo.org> wrote:
>
>> Dear Team,
>>     We are working on a project with Geo-spatial images using python
>> language for our development purpose. To visualize the images properly
>> pyramid layer is necessary. GDAL buildoverview functionality of python, we
>> are using to generate the overview but it is utilizing only the CPU. We are
>> able to generate the pyramid layer using other python library utilizing the
>> GPU but not able to add this pyramid layer into the geospatial images of
>> *".tiff"* file format as overview layer.
>>
>> Please help us in this regards if any GDAL function is there to add the
>> pyramid as overview layer.
>>
>> Thanks and Regards,
>> Pradeep Kumar Mahato
>> Phone: 080-2504 9199/ +91 8762020114
>>
>>
>>
>> <https://amritmahotsav.nic.in/>
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240312/63520377/attachment.htm>


More information about the gdal-dev mailing list