[GRASSLIST:5231] USGSDEM export

Hi!

Any way to output a raster file in a USGSDEM format
from GRASS?. If I write

r.out.gdal in=mydem format=USGSDEM out=mydem.dem

the command returns:

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

Listing all the available formats r.out.gdal
understands among other returns USGSDEM

r.out.gdal -l

...
USGSDEM: USGS Optional ASCII DEM (and CDED)

GRASS 5.7 compiled from cvs (4. 12. 2004), gdal-1.2.3.
Would a newer version of any solve the problem?

Thanks for your help, Miha Staut

___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

On Mon, Dec 27, 2004 at 02:36:00PM +0000, we recorded a bogon-computron collision of the <mihastaut@yahoo.co.uk> flavor, containing:

Hi!

Any way to output a raster file in a USGSDEM format
from GRASS?. If I write

r.out.gdal in=mydem format=USGSDEM out=mydem.dem

the command returns:

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

Listing all the available formats r.out.gdal
understands among other returns USGSDEM

r.out.gdal -l

...
USGSDEM: USGS Optional ASCII DEM (and CDED)

GRASS 5.7 compiled from cvs (4. 12. 2004), gdal-1.2.3.
Would a newer version of any solve the problem?

I'm not exactly sure what the limitation is, but I've noticed that gdal
only partitially supports output of USGSDEM format. For example, when I
try to use the GDAL tool "gdalwarp" to convert a USGSDEM from NAD27 datum
to NAD83 datum, it tells me that the USGSDEM driver does not support direct
creation. However, if I gdalwarp from the source DEM in NAD27 to an
intermediate GeoTIFF in NAD83, then use gdal_translate to create a DEM
from the GeoTIFF, it does work.

So my guess is that if you really need USGSDEM output you could probably
do it by outputting to GeoTIFF and then using gdal_translate (not a
GRASS tool, it comes with the gdal library):

  gdal_translate -of USGSDEM intermediate.tiff Final.DEM

HTH,
T.

--
Tom Russo KM5VY SAR502 DM64ux http://www.swcp.com/~russo/
Tijeras, NM QRPL#1592 K2#398 SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
"When life gives you lemons, find someone with a paper cut."

--- Tom Russo <russo@bogodyn.org> wrote:

On Mon, Dec 27, 2004 at 02:36:00PM +0000, we
recorded a bogon-computron collision of the
<mihastaut@yahoo.co.uk> flavor, containing:
> Hi!
>
> Any way to output a raster file in a USGSDEM
format
> from GRASS?. If I write
>
> r.out.gdal in=mydem format=USGSDEM out=mydem.dem
>
> the command returns:
>
> 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

>
> Listing all the available formats r.out.gdal
> understands among other returns USGSDEM
>
> r.out.gdal -l
>
> ...
> USGSDEM: USGS Optional ASCII DEM (and CDED)
>
> GRASS 5.7 compiled from cvs (4. 12. 2004),
gdal-1.2.3.
> Would a newer version of any solve the problem?

I'm not exactly sure what the limitation is, but
I've noticed that gdal
only partitially supports output of USGSDEM format.
For example, when I
try to use the GDAL tool "gdalwarp" to convert a
USGSDEM from NAD27 datum
to NAD83 datum, it tells me that the USGSDEM driver
does not support direct
creation. However, if I gdalwarp from the source
DEM in NAD27 to an
intermediate GeoTIFF in NAD83, then use
gdal_translate to create a DEM
from the GeoTIFF, it does work.

So my guess is that if you really need USGSDEM
output you could probably
do it by outputting to GeoTIFF and then using
gdal_translate (not a
GRASS tool, it comes with the gdal library):

  gdal_translate -of USGSDEM intermediate.tiff
Final.DEM

HTH,
T.

Thanks Tom,

My only scruple is GeoTIFF would destroy the
information. Could that be true?

Miha Staut

___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

On Tue, 28 Dec 2004, Miha Staut wrote:

--- Tom Russo <russo@bogodyn.org> wrote:
> On Mon, Dec 27, 2004 at 02:36:00PM +0000, we
> recorded a bogon-computron collision of the
> <mihastaut@yahoo.co.uk> flavor, containing:
> > Hi!
> >
> > Any way to output a raster file in a USGSDEM
> format
> > from GRASS?. If I write
> >
> > r.out.gdal in=mydem format=USGSDEM out=mydem.dem
> >
> > the command returns:
> >
> > 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
> >
> > Listing all the available formats r.out.gdal
> > understands among other returns USGSDEM
> >
> > r.out.gdal -l
> >
> > ...
> > USGSDEM: USGS Optional ASCII DEM (and CDED)
> >
> > GRASS 5.7 compiled from cvs (4. 12. 2004),
> gdal-1.2.3.
> > Would a newer version of any solve the problem?
>
> I'm not exactly sure what the limitation is, but
> I've noticed that gdal
> only partitially supports output of USGSDEM format.
> For example, when I
> try to use the GDAL tool "gdalwarp" to convert a
> USGSDEM from NAD27 datum
> to NAD83 datum, it tells me that the USGSDEM driver
> does not support direct
> creation. However, if I gdalwarp from the source
> DEM in NAD27 to an
> intermediate GeoTIFF in NAD83, then use
> gdal_translate to create a DEM
> from the GeoTIFF, it does work.
>
> So my guess is that if you really need USGSDEM
> output you could probably
> do it by outputting to GeoTIFF and then using
> gdal_translate (not a
> GRASS tool, it comes with the gdal library):
>
> gdal_translate -of USGSDEM intermediate.tiff
> Final.DEM
>
> HTH,
> T.

Thanks Tom,

My only scruple is GeoTIFF would destroy the
information. Could that be true?

My reading of:

http://www.gdal.org/frmt_gtiff.html

suggests that you should be OK, the range of band types is pretty large,
and less problematic than USGSDEM:

http://www.gdal.org/frmt_usgsdem.html

Roger

Miha Staut

___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand@nhh.no

On Tuesday 28 December 2004 01:18 am, Roger Bivand wrote:

----snip snip---------

> > So my guess is that if you really need USGSDEM
> > output you could probably
> > do it by outputting to GeoTIFF and then using
> > gdal_translate (not a
> > GRASS tool, it comes with the gdal library):
> >
> > gdal_translate -of USGSDEM intermediate.tiff
> > Final.DEM
> >
> > HTH,
> > T.
>
> Thanks Tom,
>
> My only scruple is GeoTIFF would destroy the
> information. Could that be true?

My reading of:

http://www.gdal.org/frmt_gtiff.html

suggests that you should be OK, the range of band types is pretty large,
and less problematic than USGSDEM:

http://www.gdal.org/frmt_usgsdem.html

Roger

> Miha Staut

I have noticed this as well in trying to reproject a NAD27 DEM to a NAD83 DEM
via gdalwarp. I found that the datum conversion worked fine if I first
created an intermediate GTiff as Richard suggested. Since i was only
interested in getting the data into GRASS, the intermediate geotiff was
enough.

However, I had to manually set the USGS NODATA value left over from the DEM to
NULL in GRASS. I used r.mapcalc, but I imagine that r.null would work even
better.

Cheers,

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341