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-boun...@lists.osgeo.org [mailto:gdal-dev-boun...@lists.osgeo.org] On Behalf Of Frank Warmerdam Sent: Thursday, September 17, 2009 2:05 PM To: Riki Tiki Cc: gdal-dev@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, warmer...@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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev