Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create very many ERDAS .img files using GDAL under C++. I don't want to have to process them all in ArcMap to create statistics for them (mainly because ArcMap fumbles when calculating statistics for very many input images in batch mode). I want to create the .img files complete with statistics calculated for each. I see python utilities for this, but nothing under the C++ API. Does anyone have a solution?

share|improve this question
What is the context? Are you making these datasets from scratch, or copying them from another source? – kyle Feb 27 '13 at 20:54

GDALRasterBand::GetStatistics() should work for you after you create your datasets and bands, see:

if you are translating data, gdal_translate -stats forces calculation of stats.

share|improve this answer
Or better: ComputeStatistics – Mike T Feb 27 '13 at 22:15
Sorry, was a typo. My link points to ComputeStatistics, Mike is right. – kyle Mar 4 '13 at 17:41
I am creating these from scratch. I'll work with GetStatistics(). Thanks very much. – Frederick Irani Mar 25 '13 at 17:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.