In my spare time I am working on interpolating algorithms for Digital Elevation Models in C++. I always obtained my elevation data set as the ESRI ASCII Raster format because it is super simple.


In the past I always obtained my Data from http://gdex.cr.usgs.gov/ which is no longer supported. It was extremely easy for me to obtain this .asc-Files on their site and now it is down. And the new recommended extractor https://lpdaacsvc.cr.usgs.gov/appeears/ seems not to provide .asc-Files. Do you have a suggestion where to obtain this data without being forced to use a third party software to convert from another format to ESRI ASCII Raster format.

  • 1
    use GDAL to read (almost) any raster format
    – Ian Turton
    Aug 9, 2019 at 9:53
  • Thanks for the tip! I will have a look on it. Because I made the Esri ASCII Raster Files to my standard. What is the most "common" processed geoFormat for Digital Elevation Models? And the Esri ASCII Raster Format seems pretty standardized, correct? Sorry for my unknowledge but I was just interested in the math behind it and now encountering API problems.
    – Zaragesh
    Aug 9, 2019 at 14:38

1 Answer 1


The joy of using the GDAL library is that you never need worry about popular formats again. If a format is at all popular then the will be a GDAL driver for it. Then all you need is to open the raster:

#include "gdal_priv.h"
#include "cpl_conv.h" // for CPLMalloc()
int main()
    GDALDataset  *poDataset;
    poDataset = (GDALDataset *) GDALOpen( pszFilename, GA_ReadOnly );
    if( poDataset == NULL )

And read it in a line at a time:

float *pafScanline;
int   nXSize = poBand->GetXSize();
pafScanline = (float *) CPLMalloc(sizeof(float)*nXSize);
poBand->RasterIO( GF_Read, 0, 0, nXSize, 1,
                pafScanline, nXSize, 1, GDT_Float32,
                0, 0 );

GDAL abstracts away all the worrying about the format and storage.

PS the most popular raster type is probably GeoTiff.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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