[GRASS-user] How to make a conversion of ERSI Grid ASCII==>USGS
DEM?
Hamish
hamish_b at yahoo.com
Mon Mar 2 01:55:44 EST 2009
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
> CREATING SUPPORT FILES FOR 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:
> AAIGrid,BMP,BSB,DTED,ELAS,ENVI,FIT,GIF,GTiff,HFA,JPEG,MEM,MFF,MFF2,
> NITF,PAux,PNG,PNM,VRT,XPM
> ''
>
> 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' ','
AAIGrid,ADRG,BMP,BT,DTED,EHdr,ELAS,ENVI,ERS,FIT,GIF,GMT,GSAG,GSBG,
GTiff,HDF4Image,HFA,IDA,ILWIS,INGR,JPEG,JPEG2000,Leveller,MEM,MFF,
MFF2,netCDF,NITF,PAux,PCIDSK,PCRaster,PNG,PNM,RMF,RST,SRTMHGT,
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
ASCII GRID to USGSDEM.
something like:
gdal_translate -of USGSDEM map_arc.grid map_usgs.dem
Hamish
More information about the grass-user
mailing list