[gdal-dev] GDAL COG - Problem with Overviews

Nicole Kamp niki.kamp at gmail.com
Fri Nov 26 03:30:55 PST 2021


Thanks a lot,
I was able to solve the problem with gdalinfo.

Nicole Kamp

On Thu, Nov 25, 2021 at 2:37 PM Rahkonen Jukka (MML) <
jukka.rahkonen at maanmittauslaitos.fi> wrote:

> Hi,
>
>
>
> Please use “reply to all” for including the list as a recipient.
>
> More details would lead to less guessing. Please add gdalinfo about the
> source and result (georeferencing is not important), tell how did you get
> the image of the original (which bands were selected, was any color
> enhancement applied). QGIS and a look at Layer properties – Symbology is
> good for that. Test with gdal_translate before going to Python and send us
> the command if you face the same trouble. If you cannot solve the problem
> yourself send a link to test image. It does not need to be your real image,
> any technically similar image is good and usually even better if you cut it
> smaller. A 200x200 pixel sized piece of the original image without
> georeferencing is one alternative that probably would not reveal secrets.
>
>
>
> -Jukka Rahkonen-
>
>
>
> *Lähettäjä:* Nicole Kamp <niki.kamp at gmail.com>
> *Lähetetty:* torstai 25. marraskuuta 2021 15.22
> *Vastaanottaja:* Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi
> >
> *Aihe:* Re: [gdal-dev] GDAL COG - Problem with Overviews
>
>
>
> Hello!
>
> Thanks. I tried it with 0,1,2 - it did not work.
>
>
>
>
>
> On Thu, Nov 25, 2021 at 1:49 PM Rahkonen Jukka (MML) <
> jukka.rahkonen at maanmittauslaitos.fi> wrote:
>
> Hi,
>
>
>
> Maybe the band list be zero based? Try [0,1,2].
>
>
>
> -Jukka Rahkonen-
>
>
>
> *Lähettäjä:* gdal-dev <gdal-dev-bounces at lists.osgeo.org> *Puolesta *Nicole
> Kamp
> *Lähetetty:* torstai 25. marraskuuta 2021 14.44
> *Vastaanottaja:* gdal-dev at lists.osgeo.org
> *Aihe:* [gdal-dev] GDAL COG - Problem with Overviews
>
>
>
> Dear GDAL Developers,
>
> I have an overview problem with my Cloud Optimized GeoTIFF.
>
> I tried to translate a 16 bit, 4 bands ortho image to a COG 8bit, 3 bands
> image with JPEG compression.
>
>
>
> That is the original image. <https://pasteboard.co/CLur6VdD0CwQ.jpg>
> That is the result. <https://pasteboard.co/MJv3lOjlI8iM.jpg>
>
>
>
> It works fine with LZW compression, but I need the JPEG compression. What
> am I doing wrong?
>
>
>
> Thanks,
>
> Niki
>
>
>
>
>
> Here is my code.
>
>         for raster in glob.glob(str(parameters[self.INPUT_Pfad])+'/*.tif'):
>             fileInfo = QFileInfo(raster)
>             baseName = fileInfo.baseName()
>             file_name =
> str(parameters[self.INPUT_Pfad])+'/'+baseName+'.tif'
>             feedback.pushInfo(file_name)
>             output_file1 =
> str(parameters[self.OUTPUT_Pfad])+'/'+baseName+'.tif'
>             output_file2 =
> str(parameters[self.OUTPUT_Pfad])+'/'+baseName+'_cog.tif'
>
>             # Create COG
>             x_size = 6250
>             y_size = 5000
>             num_bands = 4
>
>             src_ds = gdal.Open(file_name)
>             format = "GTiff"
>             driver = gdal.GetDriverByName(format)
>
>             # Translate
>             translate_options = gdal.TranslateOptions(format = 'COG',
> outputType = gdal.GDT_Byte, bandList =
>                [1,2,3],  scaleParams=[''],
>                                           creationOptions =
> ['TILED=YES','COMPRESS=JPEG','BIGTIFF=IF_NEEDED',
>                             'BLOCKXSIZE=512', 'BLOCKYSIZE=512',
> 'RESAMPLING=NEAREST',
>           'OVERVIEWS=IGNORE_EXISTING', 'INTERLEAVE=PIXEL']
>                                           )
>             gdal.Translate(output_file1, src_ds, options=translate_options)
>
>             translate_options = None
>             src_ds = None
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211126/5ed247c0/attachment.html>


More information about the gdal-dev mailing list