[Gdal-dev] Re: [GRASSLIST:4082] BSQ import question

Markus Neteler neteler at itc.it
Wed Aug 4 12:11:35 EDT 2004


(cc GDAL list, due to potential ENVI driver issues
 ref:
 http://xserve.flids.com/pipermail/gdal-dev/2004-May/005648.html

 Sorry if you receive it twice.
)

[ The question was how to import a BSQ file into GRASS.
  I'll suggest to create an ENVI hdr file ]

On Tue, Aug 03, 2004 at 09:20:36AM -0600, C.S. Cornuelle wrote:
> Yes, I know, use i.tape.other.  :^)
>
> The problem (hopefully) is that I do not know some of the particulars
> which i.tape.other requires.  The file to import is
> 
> 	gl-latlong-1km-landcover.bsq
> from
> 	http://glcfapp.umiacs.umd.edu:8080/esdi/index.jsp

The global land cover file is at:
 ftp://ftp.glcf.umiacs.umd.edu/glcf/Global_Land_Cover/Global/gl-latlong-1km-landcover/

 Information
 Image Size: 				43200 Pixels 21600 Lines 
 Quantization:			    8-bit unsigned integer
 Output Georeferenced Units: LONG/LAT E019
 Projection:    				Geographic (geodetic)
 Earth Ellipsoid:			Sphere, rad 6370997 m 
 Upper Left Corner:			180d00'00.00" W Lon90d00'00.00" N Lat
 Lower Right Corner:			180d00'00.00" E Lon 90d00'00.00" S Lat
 Pixel Size (in Degrees):	0.00833 Lon 0.00833 Lat
 (Equivalent Deg,Min,Sec):	0d00'30.00"0d00'30.00" 
 UpLeftX:					-180 
 UpLeftY:      				90
 LoRightX:        			180
 LoRightY:      				-90


-> note the Sphere!
This is relevant for the definition of the location.
See 'gl-latlong-1km-landcover.grasslocation.txt' attachment for details.

> Some of you are probably familiar with this.  Assuming this, I
> have a few questions from GRASS 5.3.
[...]
> Any ideas?  Has anyone worked with this data set?  I'm running this on
> a linux box, if it matters.

Use r.in.gdal instead. It's way easier. You just have to generate
a BSQ ENVI header file, then import the map (find attached the file).
I hope I got that file right, following
 http://glcf.umiacs.umd.edu/data/guide/fileformat/bsq.shtml
 => RSI ENVI 3.6
    However, I didn't set bands = 14 but bands = 1

Now check with 'gdalinfo':
gdalinfo -mm gl-latlong-1km-landcover.bsq
Driver: ENVI/ENVI .hdr Labelled
Size is 43200, 21600
Coordinate System is:
LOCAL_CS["Geographic Lat/Lon",
    UNIT["Meter",1]]
Origin = (-180.000000,90.000000)
Pixel Size = (0.00833333,-0.00833333)
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000)
Lower Left  (-180.0000000, -90.0000000)
Upper Right ( 180.0000000,  90.0000000)
Lower Right ( 180.0000000, -90.0000000)
Center      (  -0.0000000,   0.0000000)
Band 1 Block=43200x1 Type=Byte, ColorInterp=Undefined
    Computed Min/Max=0.000,13.000

IMHO the projection is not detected completely by GDAL,
or should it be LOCAL_CS?

If you prefer, you can also make it a GeoTIFF file,
fixing the projection description in this moment:

gdal_translate -a_srs '+init=esri:37008' \
       gl-latlong-1km-landcover.bsq gl-latlong-1km-landcover.tif

gdalinfo -mm gl-latlong-1km-landcover.tif
Driver: GTiff/GeoTIFF
Size is 43200, 21600
Coordinate System is:
GEOGCS["unnamed ellipse",
    DATUM["unknown",
        SPHEROID["unnamed",6370997,1]],
    PRIMEM["Greenwich",0],
    UNIT[,0.0174532925199433]]
Origin = (-180.000000,90.000000)
Pixel Size = (0.00833333,-0.00833333)
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000)
Lower Left  (-180.0000000, -90.0000000)
Upper Right ( 180.0000000,  90.0000000)
Lower Right ( 180.0000000, -90.0000000)
Center      (  -0.0000000,   0.0000000)
Band 1 Block=43200x1 Type=Byte, ColorInterp=Gray
    Computed Min/Max=0.000,13.000


Then import:
(color table from
 http://glcf.umiacs.umd.edu/data/landcover/data.shtml
)

r.in.gdal in=gl-latlong-1km-landcover.tif out=gl-latlong-1km-landcover
r.colors gl-latlong-1km-landcover col=rules <<EOF
0       000 000 000
1       001 100 000
2       001 130 000
3       151 191 071
4       002 220 000
5       000 255 000
6       146 174 047
7       220 206 000
8       255 173 000
9       255 251 195
10      140 072 009
11      247 165 255
12      255 199 174
13      000 255 255
EOF

d.mon x0
d.rast.leg gl-latlong-1km-landcover

Regards

 Markus Neteler

-------------- next part --------------
ENVI
samples = 43200
lines   = 21600
bands   = 1
header offset = 0
file type = ENVI Classification
data type = 1
interleave = bsq
byte order = 0
map info = {Geographic Lat/Lon, 1.0, 1.0, -180.0, 90.0, 0.00833333333333, 0.00833333333333, sphere, units=Degrees}
band names = {
Band 1}
-------------- next part --------------
This is relevant for the definition of the 
gl-latlong-1km-landcover location.


  Please specify the coordinate system for location <sphere>
  B   Latitude-Longitude

  you wish to specify a geodetic datum for this location?(y/n) [y] y
  Please specify datum name
  Enter 'list' for the list of available datums
  or 'custom' if you wish to enter custom parameters
  Hit RETURN to cancel request
  > [nothing]

  Please specify ellipsoid name
  Enter 'list' for the list of available ellipsoids
  Hit RETURN to cancel request
  >sphere
  Radius: 6370997

  Location boundaries:
                       ====== DEFAULT REGION =======
                       | NORTH EDGE:90N_______     |
                       |                           |
            WEST EDGE  |                           |EAST EDGE
            180W______ |                           |180E______
                       | SOUTH EDGE:90S_______     |
                       =============================
           PROJECTION: 3 (Latitude-Longitude)         ZONE: 0
                             GRID RESOLUTION
                                 East-West:     0:00:30___
                               North-South:     0:00:30___


More information about the Gdal-dev mailing list