[gdal-dev] gdal_merge: stacking and band statistics

Jason Roberts jason.roberts at duke.edu
Wed Oct 20 17:17:49 EDT 2010


Matt,

 

Although I have not worked with multi-band HFA format, I have experimented
fairly extensively with single-band, GDAL-produced, HFA-format files in
ArcGIS 9.3.1 SP1. Maybe my experience will be interesting to you anyway.

 

My experience was that calculating the statistics with GDAL and with ArcGIS
was not equivalent. For example, when I calculated the statistics with GDAL
for integer rasters, they did not show up with a random color classification
in ArcGIS by default. They appeared to use a black-to-white stretch instead.
This was not desirable for categorical data (e.g. landcover values). But if
I calculated the statistics using ArcGIS, they did show up with random
colors.

 

Unfortunately I did not take extensive notes on this, summarizing my
experience in my own code with this comment:

 

        # Do not use GDAL to calculate statistics.

        # Even though GDAL can do it faster than the geoprocessor, we

        # prefer to use the geoprocessor to maximize the compatibility

        # of the output raster with ArcGIS. For example, I do not know

        # how to get GDAL to build an ArcGIS-compatible histogram.

        # Without the histogram ArcGIS defaults to displaying integer

        # rasters using a black-to-white stretch rather than a unique

        # value classifier with random colors. ArcGIS users will

        # expect colors; to get the necessary histogram, we have to

        # calculate statistics with the geoprocessor.

 

I also recall there being some other differences, possibly with floating
point files, too. I'm sorry I did not take better notes.

 

I found the whole thing a bit bizarre because I thought that ArcGIS 9.3.1
used GDAL internally to manipulate HFA files. But maybe not in all
circumstances. And 9.3.1 has an ESRI-customized version of GDAL 1.4, so it
is not like they are running the latest GDAL code.

 

Anyway, hope this helps,

 

Jason

 

From: gdal-dev-bounces at lists.osgeo.org
[mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Matt Hanneman
Sent: Wednesday, October 20, 2010 4:51 PM
To: gdal-dev at lists.osgeo.org
Subject: [gdal-dev] gdal_merge: stacking and band statistics

 

Hi,

Can anyone help a newbie? I have been trying to calculate statistics with
gdal_merge when merging/stacking several tiffs together into a HFA format
(see below for syntax). However, when loaded into ArcGIS it reports that
there are no statistics calculated for any of the bands. Will the
'STATISTICS' option not work when stacking multiple bands? As you can
probably tell I am fairly new to this, so forgive my ignorance.

gdal_merge -co STATISTICS=YES -v -o "E:/Temp/A2E.img" -of HFA -separate
"A.TIF" "B.TIF" "C.TIF" "D.TIF" "E.TIF" "F.TIF"

Thanks,

Matt 

 

-- 

Matt Hanneman
Director of GIS and Remote Sensing
Global Forest Watch Canada
10337 146 St, Edmonton, AB T5N 3A3
Tel: 780-422-5989 Fax: 780-454-5521 
www.globalforestwatch.ca <http://www.globalforestwatch.ca/> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20101020/86191ccf/attachment-0001.html


More information about the gdal-dev mailing list