Bug report #14106
gdal info -stats are approximate if ".aux.xml" has been created.
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Rasters | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | end of life |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 22112 |
Description
When Using gdalinfo with the "-stats" switch, raster statistics are exact only if the ".aux.xml" file has not been created. If the .aux.xml file has been created by qgis, statistics are approximate. This is a big problem as the only way to get the correct statistic is to close QGIS, delete the file and Start Qgis again. The processing "Raster Layer Statistics" works all the time.
History
#1 Updated by Alexander Bruy almost 9 years ago
- Status changed from Open to Feedback
Works fine here.
Do you have this bug also when running gdalinfo from console?
#2 Updated by Nicolas Cadieux almost 9 years ago
- File gdal_info.txt added
I have had this issues since at least QGIS 2.4 on multiplie Windows 7_64 machines all using the OSGeo4W64.
Steps to reproduce:
a: Start QGIS and go to a Directory will 1 tiff file only.
b: Go to raster/miscellaneous/information and add -stats: "gdalinfo H:/Dem_sol_151013.tiff -stats". Press enter. This will take a while(raster is 84GB): Minimum=-0.920, Maximum=787.450, Mean=335.777, StdDev=179.543
c:Close qgis while not saving the project: Dem_sol_151013.tiff.aux.xml is now in the directory
d:Open QGIS and try steps b: This will be fast: Minimum=-0.630, Maximum=778.970, Mean=335.169, StdDev=179.670
Results are identical when using gdalinfo -stats at the OSGeo4W shell.
Once the xml file is wrote, there is now way of getting the correct exact stats. As stat contained in the file override the exacts statistics:
xml: <Metadata>
<MDI key="STATISTICS_MAXIMUM">778.96997070313</MDI>
<MDI key="STATISTICS_MEAN">335.16934270393</MDI>
<MDI key="STATISTICS_MINIMUM">-0.62999999523163</MDI>
<MDI key="STATISTICS_STDDEV">179.66989242974</MDI>
</Metadata>
See file.
If this is the default (and it should not be), it should be noted very clearly as this can really have an impact on research. Steps to have the correct specific stats should be available in GUI.
Hope this helps.
#3 Updated by Alexander Bruy almost 9 years ago
Sorry I still can not reproduce it here. I always get same result with or without .aux.xml file.
If you get wrong results when running gdalinfo directly from command line, than this looks like GDAL bug.
#4 Updated by Giovanni Manghi over 8 years ago
- Target version deleted (
Future Release - High Priority) - Status changed from Feedback to Open
- Category changed from GDAL Tools to Rasters
- File REAL_dtm_1km_6185_693.tif.aux.xml added
- File APROX_dtm_1km_6185_693.tif.aux.xml added
- Affected QGIS version changed from 2.12.2 to master
- Operating System deleted (
Windows 7_64 OSGeo4W64)
Alexander Bruy wrote:
Sorry I still can not reproduce it here. I always get same result with or without .aux.xml file.
If you get wrong results when running gdalinfo directly from command line, than this looks like GDAL bug.
Hi Alexander,
I see the difference/issue, and you can see the related ticket comment here (and sample data)
by default QGIS computes stats in an approximate way, once the .aux.xml with approximate stats then gdalinfo will use it. The .aux.xml is update with real stats only if the user chooses "accuracy: actual/slower" in raster properties.
#5 Updated by Giovanni Manghi over 7 years ago
- Regression? set to No
- Easy fix? set to No
#6 Updated by Giovanni Manghi over 5 years ago
- Resolution set to end of life
- Status changed from Open to Closed
End of life notice: QGIS 2.18 LTR
Source:
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/