[GRASS-user] How to make a conversion of ERSI Grid ASCII==>USGS DEM?

Illidan illidan.modeler at gmail.com
Mon Mar 2 03:18:46 EST 2009

I'm not lucky enough with a successful gdal_translate.

> gdal_translate -of USGSDEM srtm_60_04.asc srtm_60_04.dem --debug on
GDAL: GDALOpen(srtm_60_04.asc) succeeds as AAIGrid.
Input file size is 6000, 6000
ERROR 1: DEM Default Setup: Importing source dataset projection failed
GDAL: GDALClose(srtm_60_04.asc)
GDAL: GDALDeregister_GTiff() called.

I wonder if my data is not valid, so I also try a DTED conversion by
"gdal_translate -of DTED srtm_60_04.asc srtm_60_04.dem --debug on".

The output is even worse, crashing with a complain

"GDAL: GDALOpen(srtm_60_04.asc) succeeds as AAIGrid.
Input file size is 6000, 6000
0Warning 1: The source does not appear to be a properly formatted cell.
Warning 1: The corner coordinates of the source are not properly
aligned on plain latitude/longitude boundaries.
...10...20...30...40...50...60...70...80...90...100 - done.
*** buffer overflow detected ***: gdal_translate terminated
======= Backtrace: =========

The source of my data is (which covers a large portion of the world
and supports ESRI ASCII output):


My gdal_translate is a 1.5.2 on ubuntu 8.10.

$ gdal_translate --version
GDAL 1.5.2, released 2008/05/29

On Mon, Mar 2, 2009 at 2:55 PM, Hamish <hamish_b at yahoo.com> wrote:
> Illidan wrote:
>> By now I'm successful with importing the ESRI ASC by r.in.arc
>> > r.in.arc input=srtm_60_04.asc output=beijing
>> However, when I try
>>  r.out.gdal input=beijing output=beijing.dem format=USGSDEM
>> it replies with "Error: value <USGSDEM> out of
>> range for parameter <format>
>>        Legal range:
>> ''
>> In fact when I run it with "-l" option as
>> "r.out.gdal input=beijing
>> output=beijing.dem -l'', it responses with a
>> listing including
>> 'USGSDEM' that looks like:
>>   FIT: FIT Image
>>   RMF: Raster Matrix Format
>>   RST: Idrisi Raster A.1
>>   INGR: Intergraph Raster
>>   GSAG: Golden Software ASCII Grid (.grd)
>>   GSBG: Golden Software Binary Grid (.grd)
>>   USGSDEM: USGS Optional ASCII DEM (and CDED)
>>   ADRG: ARC Digitized Raster Graphics
>> So I'm confused whether USGSDEM is valid or not.
> mmph. problem with r.out.gdal. there is a switch somewhere called
> __ALLOW_DYNAMIC_OPTIONS__. For me it is true and my format= list of
> supported format is the full one. If that wasn't set when the program
> was compiled it just falls back on a short list someone put in there
> some time ago.
> The '-l' flag talks to gdal unconditionally so you always get the full
> list.
> with new versions of GDAL, more and more formats are supported but
> r.in.gdal's fail-over format= list hasn't been updated.
> for me using modern gdal 1.5.2 from DebianGIS I get a lot more formats
> than the fail-over list:
> $ gdalinfo --formats | grep '\(rw\)' |cut -f1 -d'(' | sed -e '1d' | \
>    awk '{print $1}' | sort -f | tr '\n' ','
> Terragen,USGSDEM,XPM
> So: if you have the source code just //comment out the
>  format->options = gdal_formats;
> line in main.c and rebuild. if you are working from an installer package
> you will have to bug the person who made the package to enable the
> __ALLOW_DYNAMIC_OPTIONS__ switch or use gdal_translate (see below).
> dev: probably if dynamic options is not set it should be left blank
> instead of using a hard-coded list which will always out of date or
> refer to someone else's gdal.
> Another option as this is raster->raster is to bypass GRASS altogether
> and use the gdal_translate utility program to convert directly from Arc
> something like:
>  gdal_translate -of USGSDEM  map_arc.grid  map_usgs.dem
> Hamish

Networking System Modeler
Northern Capital, Republic of Pandaren

More information about the grass-user mailing list