[GRASSLIST:4082] BSQ import question

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

Some of you are probably familiar with this. Assuming this, I
have a few questions from GRASS 5.3.

With i.tape.other we have:

GENERIC TAPE EXTRACTION

tape layout

0___ number of tape files to be skipped
0___ number of records in the remaining files to be skipped
0___ number of bytes in each record to be skipped

band files

0___ number of bands on the tape

data format
_ band sequential (BSQ) | mark one with an x
_ band interleaved (BIL) |

0_____ if you select BSQ format and all the bands are in a
       single file,
                 enter the total number of records in the file.
     Otherwise enter 0

0_____ length (in bytes) of the longest record on
      the tape
1___ blocking factor of data in the file

OK, so what should I use here? From the online docs it looks like
the number of bands is 1. The longest record is 1 byte, right? From
header information it may be the case that the number of records is
36494965. This will not fit in the space provided.

Then we have:

EXTRACT

please select region of the image to extract

start row: 1______
end row: 21600__

start col: 1______
end col: 43200__

which leads to this dread result:

Segmentation fault

Any ideas? Has anyone worked with this data set? I'm running this on
a linux box, if it matters.

Thanks for your time.

--
Adios,
Chris Cornuelle
bob at xmission dot com

(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

(attachments)

gl-latlong-1km-landcover.bsq.hdr (283 Bytes)
gl-latlong-1km-landcover.grasslocation.txt (1.17 KB)

On Wed, Aug 04, 2004 at 06:11:35PM +0200, Markus Neteler wrote:

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?

Markus,

I can't reproduce your result. I have the following with your .hdr file:

$ gdalinfo gl-latlong-1km-landcover.bsq
Driver: ENVI/ENVI .hdr Labelled
Size is 43200, 21600
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9108"]],
    AXIS["Lat",NORTH],
    AXIS["Long",EAST],
    AUTHORITY["EPSG","4326"]]
Origin = (-180.000000,90.000000)
Pixel Size = (0.00833333,-0.00833333)
Corner Coordinates:
Upper Left (-180.0000000, 90.0000000) (180d 0'0.00"W, 90d 0'0.00"N)
Lower Left (-180.0000000, -90.0000000) (180d 0'0.00"W, 90d 0'0.00"S)
Upper Right ( 180.0000000, 90.0000000) (180d 0'0.00"E, 90d 0'0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0'0.00"E, 90d 0'0.00"S)
Center ( -0.0000000, 0.0000000) ( 0d 0'0.00"W, 0d 0'0.00"N)
Band 1 Block=43200x1 Type=Byte, ColorInterp=Undefined
  Description = Band 1

Are you using the latest CVS snapshot?

--
Andrey V. Kiselev
Home phone: +7 812 5274898 ICQ# 26871517

On Sat, Aug 07, 2004 at 11:57:39PM +0400, Andrey Kiselev wrote:

On Wed, Aug 04, 2004 at 06:11:35PM +0200, Markus Neteler wrote:
> 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?

Markus,

I can't reproduce your result. I have the following with your .hdr file:

$ gdalinfo gl-latlong-1km-landcover.bsq
Driver: ENVI/ENVI .hdr Labelled
Size is 43200, 21600
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9108"]],
    AXIS["Lat",NORTH],
    AXIS["Long",EAST],
    AUTHORITY["EPSG","4326"]]
Origin = (-180.000000,90.000000)
Pixel Size = (0.00833333,-0.00833333)
Corner Coordinates:
Upper Left (-180.0000000, 90.0000000) (180d 0'0.00"W, 90d 0'0.00"N)
Lower Left (-180.0000000, -90.0000000) (180d 0'0.00"W, 90d 0'0.00"S)
Upper Right ( 180.0000000, 90.0000000) (180d 0'0.00"E, 90d 0'0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0'0.00"E, 90d 0'0.00"S)
Center ( -0.0000000, 0.0000000) ( 0d 0'0.00"W, 0d 0'0.00"N)
Band 1 Block=43200x1 Type=Byte, ColorInterp=Undefined
  Description = Band 1

Are you using the latest CVS snapshot?

Andrey,

yes: latest and greatest GDAL and PROJ4 CVS (as always).
I'll double-check and recompile from scratch, maybe
you could send me your ENVI hdr file off-list? Perhaps
an issue of caps letters?

Markus

--
Andrey V. Kiselev
Home phone: +7 812 5274898 ICQ# 26871517

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

Dear Markus Neteler,

I have a problem related to the previous discussion about "BSQ import question" : actually, I plan to import exactly the same database in GRASS5 and following the answer that you gave, I installed gdalinfo and I tried:

gdalinfo -mm gl-latlong-1km-landcover.bsq

and it returns me:

ERROR 4: `gl-latlong-1km-landcover.bsq' not recognised as a supported file format.

For info, I try this on my Suse 9.3 Linux version. I also run grass5.0.3 trying a "r.in.gdal" and I got returned the same answer from GRASS.
I recompiled the libgdal.so (I downloaded gdal-1.3.0.tar.gz <http://www.gdal.org/dl/gdal-1.3.0.tar.gz&gt; from "http://www.gdal.org/dl/&quot; and I also gdal-1.2.1.tar.gz <http://www.gdal.org/dl/gdal-1.3.0.tar.gz&gt; ) but nothing changed.

Any idea of what is going wrong ?

Thanks,

Bruno Guillaume.

Markus Neteler wrote:

(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

------------------------------------------------------------------------

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}
------------------------------------------------------------------------

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___