[gdal-dev] Re:

Jason Roberts jason.roberts at duke.edu
Thu Sep 17 17:23:44 EDT 2009


I do not know whether the new fixes would help or not. When I calculate the
statistics with ArcGIS, no .aux.xml file is generated. I believe ArcGIS is
storing the statistics in a .aux file instead. Here is the sequence of
events that suggests it.

1. I created a 8192x4096 float32 .tif file with GDAL:

09/17/2009  04:53 PM       134,284,081 sst2004d.tif

2. I started ArcCatalog, navigated to the directory containing the file, and
selected it. Selecting it does not actually display anything but nonetheless
causes ArcCatalog to create a .aux file:

09/17/2009  05:12 PM             5,056 sst2004d.aux
09/17/2009  04:53 PM       134,284,081 sst2004d.tif

3. I right-clicked, selected Properties, and observed that there were no
statistics. (This operation did not touch the files.) I executed the ArcGIS
Calculate Statistics tool on the file. This touched the .aux file and
created a .xml file:

09/17/2009  05:16 PM            36,591 sst2004d.aux
09/17/2009  04:53 PM       134,284,081 sst2004d.tif
09/17/2009  05:16 PM               566 sst2004d.tif.xml

That XML file only contains metadata; a record of the processing:

<?xml version="1.0"?>
<!--<!DOCTYPE metadata SYSTEM
cOnce><DataProperties><lineage><Process ToolSource="C:\Program
Files\ArcGIS\ArcToolbox\Toolboxes\Data Management
Tools.tbx\CalculateStatistics" Date="20090917"
Time="171630">CalculateStatistics C:\Temp2\sst2004d.tif 1 1 #

Given that the .tif itself was not touched, it seems that the statistics
were stored in the .aux file. If this is true, do you think ArcGIS will pay
attention to the .aux.xml file that GDAL will generate? I don't know much
about this stuff so your guess is better than mine.

Also, please disregard my previous claim that ArcGIS 9.3.1 was not able to
recognize the NoData value written by the GTiff driver. I got confused about
which machine I was using and tested that scenario with ArcGIS 9.1. I can
confirm that ArcGIS 9.3.1 does recognize the NoData value properly in the
scenario above.


-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
Sent: Thursday, September 17, 2009 3:58 PM
To: Jason Roberts
Cc: 'Riki Tiki'; gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] Re:

Jason Roberts wrote:
> 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
> 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
> them with ArcGIS, if desired, but like Riki, it would be useful if I did
> need to do this.


I notice that if I run gdalinfo -stats from trunk I get the stats written
to the .aux.xml file while I don't from the 1.6 branch.  I think this is
something that has been fixed recently.  I'd suggest working from trunk if
that is at all practical.

If it is important, I could backport some of the statistics retaining
fixes back to 1.6 branch.

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

More information about the gdal-dev mailing list