[gdal-dev] getting statistics of GTiff precomputed

Riki Tiki mongoose_riki at mail.ru
Thu Sep 17 14:39:34 EDT 2009


In my case I have no problems with no data values... ArcGIS sees them right.

I don't know whether this is important or not...

1) When i convert raster to ascii using ArcGIS it writes no data value as -9999.
2) When i convert the same raster to ascii using gdal_translate, my no data value becomes 255.

But in both cases ArcGIS recognizes the no data values...

The problem so far that I have seen is this (which i cannot solve yet...):

1) when i use gdal_translate to convert ascii to gtiff file... i don't get statistics computed.

even after doing gdalinfo -stats a.tif, i still don't get statistics file .aux.xml

2) but when i open the a.tif file using ArcGIS then ask it to compute the statistics, it computes and generates extra files such as: a.aux and a.tif.vat...

Thanks a lot!


-----Original Message-----
From: "Jason Roberts" <jason.roberts at duke.edu>
To: "'Frank Warmerdam'" <warmerdam at pobox.com>,
"'Riki Tiki'" <mongoose_riki at mail.ru>
Date: Thu, 17 Sep 2009 14:24:55 -0400
Subject: RE: [gdal-dev] Re:

> Riki,
> Please let us know whether Frank's suggestion works or not. I have been
> experimenting with writing GeoTIFFs using GDAL 1.6.0 and the Python bindings
> and have not been successful so far at using GDAL to calculate statistics
> that ArcGIS recognizes. It would be interesting to know whether this
> suggestion will work.
> If anyone is interested, after creating a GTiff with one band, writing
> values to the band, flushing the cache, I have been calling
>     band.SetStatistics(*band.GetStatistics(False, True))
> and then looking at the resulting file from ArcGIS 9.3.1 (the latest
> version). ArcGIS reports that there are no statistics. I can then calculate
> them with ArcGIS, if desired, but like Riki, it would be useful if I did not
> need to do this.
> The technique works for .img files (HFA driver). If I do not call
> SetStatistics, ArcGIS reports there are no statistics. But when I do call
> it, as shown above, ArcGIS can see the statistics. This led me to believe it
> was the right technique but that there is a GDAL/ArcGIS incompatibility
> around statistics in GeoTIFFs.
> Another thing that ArcGIS users should be aware of is the that the Calculate
> Statistics tool in ArcGIS also creates a raster attribute table. GDAL
> SetStatistics does not do this. GDAL 1.6.x appears to have some
> functionality relating to raster attribute tables but I have not
> experimented with it yet. It is another thing to check for if you're looking
> for 100% compatibility between GDAL and ArcGIS.
> Finally, I am encountering an issue with NoData values. Riki can you please
> let us know if NoData cells show up properly in ArcGIS? When I call
> band.SetNoDataValue when creating a GTiff with the Python API, ArcGIS does
> not seem to recognize it. I also tried CreateMaskBand() with
> GDAL_TIFF_INTERNAL_MASK set to YES. It did not work either.
> Best regards,
> Jason
> -----Original Message-----
> From: gdal-dev-bounces at lists.osgeo.org
> [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Frank Warmerdam
> Sent: Thursday, September 17, 2009 2:05 PM
> To: Riki Tiki
> Cc: gdal-dev at lists.osgeo.org
> Subject: [gdal-dev] Re:
> Riki Tiki wrote:
> > @Frank and Hermann: Thanks a lot!
> > 
> > My other question is as follows:
> > 
> > 1) gdal_translate -of AAIGrid a.tif a.asc
> > 
> > it creates the following: a.asc (ASC File), a.asc.aux (XML Document), and
> a
> > (IDL project file)...
> Riki,
> Not that the .prj file is not an IDL project file, it is an ArcGIS
> projection file.
> > now to do the reverse i do the following:
> > 
> > 2) gdal_translate -of GTiff a.asc a.tif
> > 
> > it creates: a.tif (TIF Image)
> > 
> > but when i open a.tif with ArcGIS it shows that its statistics are not
> > calculated...
> > 
> > Can you tell me how to create the 2) with statistics already computed? So
> > that when i open it in ArcGis for example I do not have to ask ArcGIS to
> > compute the statistics? Thanks a lot!
> If you use a recent enough version of ArcGIS the following *might*
> precompute the stats in a useful fashion for ArcGIS.
>    gdalinfo -stats a.tif
> Best regards,
> -- 
> ---------------------------------------+------------------------------------
> --
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

More information about the gdal-dev mailing list