[GRASSLIST:1440] Re: import .bil DEM file (cascadia.bil)

Hamish hamish_nospam at yahoo.com
Wed Oct 8 04:03:06 EDT 2003


> I am working in a Lat/Lon location, the cascadia.bil file reflects a
> UTM location - does that cause additional problems?


Looking at the metadata file:

Create a Lambert conformal conic location and import into that.
e.g.
 "D" Other Projection
 proj= lcc
 ellipsoid= clark66
 datum= nad27 ??
 lat_0= 38N ??
 lat_1= 41:30N
 lat_2= 50:30N
 lon_0= 124:30W
 x_0= 0.0
 y_0= 0.0

 n=1710340.289
 s=101590.289
 w=-738044.062
 e=749705.938
 res=250.0

The setup screen doesn't have the room for all of the digits; you'll
have to tend to that after the mapsets are created. So after you make it
the grass prompt, do:

GRASS:~ > g.region n=1710340.289 s=101590.289 w=-738044.062 e=749705.938
GRASS:~ > g.region -p

and you should see res = 250 exactly.



> *** UTM location ***
[LCC not UTM..]

> GRASS:~/geodata/dem/cascadia > r.in.bin -s input=cascadia.bil 
> output=cascadia.grass bytes=1 north=1710340.289 south=101590.289 
> east=749705.938 west=-738044.062
> Using rows=1608749 cols=1487749
> Bytes do not match File size
> File Size 76589370 ... Total Bytes 1117932129
> Try bytes=0 or adjusting input parameters

try:
GRASS:~ > r.in.bin -s input=cascadia.bil output=cascadia.grass bytes=1 \
north=1710340.289 south=101590.289 east=749705.938 west=-738044.062 \
r=6435 c=5951 bytes=2

> >> ***** cascadia.hdr: *****
> >> BYTEORDER      M
[-s or -b ?]

> >> LAYOUT       BIL
> >> NROWS         6435
> >> NCOLS         5951
[r= c= above]

> >> NBANDS        1
> >> NBITS         16
nbits 16 means you should use bytes=2 as well.


6435 rows * 5951 cols * 2bytes/cell = File Size 76589370


note from the man page:
 The geographic coordinates north, south, east, and  west  describe  the
 outer  edges of the geographic region.  They run along the edges of the
 cells at the edge of the geographic region and not through  the  center
 of the cells at the edges.

So you may have to add/subtract 125.0m to each edge to get the correct
bounds. I believe ARC uses cell centers as the reference..


Are you *sure* r.in.gdal won't handle this as type "AIG"? That would
remove much of the pain from this process.


After that is in correctly & you can see it with d.rast & query good
numbers with d.what.rast, exit GRASS and then create your lat/lon 
location. 'Import' the map from the LCC location with r.proj. Try GRASS
5.3+ if you want to reproject with a datum transform (say to WGS84).


good luck,
Hamish


> >> for quite a while I am trying to import a *.bil file
> >> into GRASS 5.0.1 by
> >> using various modules (r.in.bin and r.in.gdal).
> >> I am not familliar with the *.bil format, but the
> >> archive "cascdem.tar.gz"
> >> I downloaded from
> >> http://geopubs.wr.usgs.gov/open-file/of99-369/
> >> includes
> >> some meta data which I applied when using the import
> >> modules.
> >>
> >> However, so far I haven't been lucky although I
> >> think I more or less tried
> >> every possible combination of the parameters given
> >> below.
> >>
> >> As info for the data set itself: It contains a
> >> 250-meter digital elevation
> >> model (DEM) for Cascadia (latitude 39N - 53N,
> >> longitude 116W - 133W), a
> >> region that encompasses the Cascade volcanic arc,
> >> the Cascadia subduction
> >> zone, and the Juan de Fuca Ridge system offshore
> >> Washington (USA) and
> >> British Columbia (Canada).
> >>
> >> Any help is appreciated, thank you all!
> >>
> >> Cheers, Torge
> >>
> >> Here below I copied the available information which
> >> is included in the tar
> >> archive.
> >> ***** cascadia.blw: *****
> >>                   250.00000000000000
> >>                     0.00000000000000
> >>                     0.00000000000000
> >>                  -250.00000000000000
> >>               -737919.06250000000000
> >>               1710215.28906250000000
> >>
> >> ***** cascadia.hdr: *****
> >> BYTEORDER      M
> >> LAYOUT       BIL
> >> NROWS         6435
> >> NCOLS         5951
> >> NBANDS        1
> >> NBITS         16
> >> BANDROWBYTES         11902
> >> TOTALROWBYTES        11902
> >> BANDGAPBYTES         0
> >>
> >> ***** cascadia.prj *****
> >> Projection    LAMBERT
> >> Zunits        NO
> >> Units         METERS
> >> Spheroid      CLARKE1866
> >> Xshift        0.0000000000
> >> Yshift        0.0000000000
> >> Parameters
> >>   41 30  0.000 /* 1st standard parallel
> >>   50 30  0.000 /* 2nd standard parallel
> >> -124 30  0.000 /* central meridian
> >>   38  0  0.000 /* latitude of projection's origin
> >> 0.00000 /* false easting (meters)
> >> 0.00000 /* false northing (meters)
> >>
> >> ***** cascadia.stx *****
> >> 1 5147 14378 9371.3 2076.8
> >>
> >> ***** excerpts from README.txt *****
> >> This report contains a 250-meter digital elevation
> >> model (DEM) for Cascadia
> >> (latitude 39N - 53N, longitude 116W - 133W), a
> >> region that encompasses the
> >> Cascade volcanic arc, the Cascadia subduction zone,
> >> and the Juan de Fuca
> >> Ridge system. The DEM is distributed as file
> >> cascdem.tar.gz  (39 MB; 78MB
> >> uncompressed).
> >>
> >> The DEM contains elevation values in integer meters,
> >> at regularly-spaced
> >> points in a Lambert conformal conic projection with
> >> standard parallels at
> >> latitudes 41.5N and 50.5N, and a central longitude
> >> of 124.5W (the
> >> "Cascadia" projection.).
> >>
> >> To ease data transfer for the widest possible range
> >> of users, the DEM is
> >> distributed as a BIL (Band Interleave by Line) file,
> >> produced with the ARC
> >> GRIDIMAGE command. For grids (the ARC term for a DEM
> >> in the form of a
> >> regular array of height values), such files are more
> >> compact than ARC
> >> export (.e00) files and USGS DEM-format files, and
> >> are much faster to
> >> create and import. They can also be read by many
> >> applications other than
> >> ARC. cascadia.bil is such a file of binary integers.
> >> Elevations are stored
> >> in cascadia.bil as unsigned positive 2-byte binary
> >> integers, in Motorola
> >> byte-order (default for Sun hardware), with an
> >> offset of 10000. That is,
> >> 203 meters is stored as 10203 meters, and values
> >> less than 10000 represent
> >> negative elevations. Values of 0 in cascadia.bil
> >> represent no data. Values
> >> are given by row, west to east, starting at the
> >> north edge of the region.
> >>
> >> To convert CASCADIA files to an ARC grid
> >>
> >> Assemble the cascadia.* files (.bil, .blw, .hdr,
> >> prj; .stx is not
> >> necessary) in one directory. Make this your
> >> workspace.
> >>
> >>       Arc: imagegrid cascadia casc1
> >>       Arc: grid
> >>       Grid: casc2 = con(casc1 <> 0, casc1 - 10000)
> >>       Grid: &sys cp cascadia.prj casc2/prj.adf
> >>
> >> If you DESCRIBE casc2 in ARC, you should get
> >>
> >>       Description of Grid CASC2
> >>
> >>       Cell Size = 250.000 Data Type: Integer
> >>       Number of Rows = 6435 Number of Values = 8555
> >>       Number of Columns = 5951 Attribute Data
> >> (bytes) = 8
> >>
> >>       BOUNDARY STATISTICS
> >>
> >>       Xmin = -738044.062 Minimum Value =
> >> -4853.000rs)
> >>       0.00000
> >>
> >>       Xmax = 749705.938 Maximum Value = 4378.000
> >>       Ymin = 101590.289 Mean = -628.692
> >>       Ymax = 1710340.289 Standard Deviation =
> >> 2076.818
> >>
> >>                            COORDINATE SYSTEM
> >> DESCRIPTION
> >>
> >>       Projection              LAMBERT
> >>       Zunits                  UNKNOWN
> >>       Units                    METERS
> >> Spheroid
> >>       CLARKE1866
> >>       Parameters:
> >>       1st standard parallel
> >>          41 30
> >>       0.000
> >>       2nd standard parallel
> >>          50 30
> >>       0.000
> >>       central meridian
> >>         -124 30
> >>       0.00
> >>       latitude of projection's origin
> >>          38  0
> >>       0.000
> >>       false easting (meters)
> >>       0.00000
> >>       false northing (meters)
> >>       0.00000
.




More information about the grass-user mailing list