Code Monkey home page Code Monkey logo

Comments (7)

vincentsarago avatar vincentsarago commented on May 25, 2024 1

Is there any way I can modify the band overviews without breaking COG?

no, you need to do a full re-write of the COG!

from rio-cogeo.

vincentsarago avatar vincentsarago commented on May 25, 2024

Hi @hnagrath09,
Can you share the command you use to create the COG ?

could you also confirm that pixel values are the same within QGIS or share the files.

from rio-cogeo.

dionhaefner avatar dionhaefner commented on May 25, 2024

IIRC, QGIS uses overviews to compute min and max, so the values shown are approximate. I would suggest you read the full raster in rasterio and compute the min and max by hand to see if they really are different.

from rio-cogeo.

vincentsarago avatar vincentsarago commented on May 25, 2024

@hnagrath09 is the issue solved ?

from rio-cogeo.

hnagrath09 avatar hnagrath09 commented on May 25, 2024

Hi @hnagrath09,
Can you share the command you use to create the COG ?

could you also confirm that pixel values are the same within QGIS or share the files.

Hi Vincent,

I am simply using
rio cogeo create <input> <output>

I have checked with one more DSM. It also shares the same problem. Also, the value tool is giving different values for both raw and COG tif. I haven't checked with rasterio yet. It may be due to the reason mentioned by @dionhaefner because values are more precise at greater zoom levels.

Screenshot 2019-06-29 at 2 05 15 PM

from rio-cogeo.

vincentsarago avatar vincentsarago commented on May 25, 2024

because values are more precise at greater zoom levels.

so there is no real bug, QGIS uses overview to get data values, feel free to re-open @hnagrath09

from rio-cogeo.

vatsa-asteria avatar vatsa-asteria commented on May 25, 2024

Hi @vincentsarago. I need to update the COG file to have same min/max overviews as the original raster. But using either GDAL or RasterIO as below breaks COG.

With RasterIO:

orig = rasterio.open('original_dsm.tif')
cog = rasterio.open('cog_dsm.tif', 'r+')

cog.update_tags(1, **orig.tags(1))
cog.close()

With GDAL:

orig = gdal.Open('original_dsm.tif')
cog = gdal.Open('cog_dsm.tif', gdal.GA_Update)

orig_band1 = orig.GetRasterBand(1)
cog_band1 = cog.GetRasterBand(1)
stats = orig_band1.GetStatistics(True, True)

cb1.SetStatistics(stats[0], stats[1], stats[2], stats[3])
cog = None

Is there any way I can modify the band overviews without breaking COG?

from rio-cogeo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.