[GRASSLIST:2472] Re: gdal and hdf

Lorenzo Moretti lorenzo.moretti at bologna.enea.it
Thu Feb 5 04:18:58 EST 2004


Ian Macmillan wrote:

>Hi all, sorry to be pestering the list lately, every time I think I 
>get it all,
>I realize just how big the mountain of information is that I don't understand.
>
>Here's my problem, I downloaded some aster dems from the EOS data gateway.  It
>comes in HDF-EOS format, and obviously my r.in.gdal (version 1.1.7 I believe)
>can not read it (I am running 5.0.0 on mac os 10.2.8).  I would like 
>to be able
>to import this data into GRASS, however it seems very non intuitive to a mac
>user like me (I installed GRASS with the openosx cd).  I have read and reread
>the mail archives and tutorials, as well as several other web sources, but I
>still just don't get how I can do this.  It seems to me that I need to update
>gdal to 1.1.9 (it looks like it handles hdf 4.x and hdf-eos files), and then I
>should be ok, but how do I do this?  I have downloaded the binaries from
>remotesensing.org. and it is sitting on my desktop staring at me.  Now what?
>
>Can I just update gdal without having to recompile grass?
>How do I update gdal?
>If I need to recompile grass, how do I do that on osx?
>
>Mucho thanks for any help you all might give,
>Ian

In my site you find last gdal1.1.9cvs, Grass5.3cvs, 5.7cvs 
precompiled binaries:

http://wwwamb.bologna.enea.it/forgrass

You have to read the INSTALL file.
You have to install FINK unstable packages (http://fink.sf.net). In 
Fink there are many libraries for my Grass binaries like HDF 4.1r5. 
You install it: my gdal binary support this library (it install in 
/usr/local). GDAL only support HDF vers 4 (not the new HDF vers 5)

I don't know where Grass OpenOSX grass install all files and support libraries)
My Grass support this gdal. My Grass works with many fink libraries 
(in /sw directory) and my libraries (in /usr/local)

After the install procedure you can use bin program from gdal.
Open Terminal
Example of ASTER Level1B file:

[lor:~] lor% /usr/local/bin/gdalinfo 
/ASTER_files/ASTER_FO_gen02/AST_L1B_003_01102002101254_05222002150244.hdf

you see the information about your ASTER file

Driver: HDF4/Hierarchical Data Format Release 4
Size is 512, 512
Coordinate System is `'
Metadata:
   HDFEOSVersion=HDFEOS_V2.6
   IDOFASTERGDSDATAGRANULE=ASTL1B 0201101012540205220094
   RECEIVINGCENTER=EDOS
   PROCESSINGCENTER=ASTER-GDS
.....
snip
.....
 
SUBDATASET_12_NAME=HDF4_SDS:ASTER_L1B:"/ASTER_files/ASTER_FO_gen02/AST_L1B_003_01102002101254_05222002150244.hdf":17
   SUBDATASET_12_DESC=[700x830] ImageData11 (16-bit unsigned integer)
 
SUBDATASET_13_NAME=HDF4_SDS:ASTER_L1B:"/ASTER_files/ASTER_FO_gen02/AST_L1B_003_01102002101254_05222002150244.hdf":18
   SUBDATASET_13_DESC=[700x830] ImageData12 (16-bit unsigned integer)
 
SUBDATASET_14_NAME=HDF4_SDS:ASTER_L1B:"/ASTER_files/ASTER_FO_gen02/AST_L1B_003_01102002101254_05222002150244.hdf":19
   SUBDATASET_14_DESC=[700x830] ImageData13 (16-bit unsigned integer)
 
SUBDATASET_15_NAME=HDF4_SDS:ASTER_L1B:"/ASTER_files/ASTER_FO_gen02/AST_L1B_003_01102002101254_05222002150244.hdf":20
   SUBDATASET_15_DESC=[700x830] ImageData14 (16-bit unsigned integer)
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)
[lor:~] lor%

Now you see the information about your ASTER SUBDATASET file:

[lor:~] lor% /usr/local/bin/gdalinfo 
HDF4_SDS:ASTER_L1B:"/ASTER_files/ASTER_FO_gen02/AST_L1B_003_01102002101254_05222002150244.hdf":2
ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
Driver: HDF4Image/HDF4 Dataset
Size is 4980, 4200
Coordinate System is:
PROJCS["UTM Zone 33, Northern Hemisphere",
     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"]],
     PROJECTION["Transverse_Mercator"],
     PARAMETER["latitude_of_origin",0],
     PARAMETER["central_meridian",15],
     PARAMETER["scale_factor",0.9996],
     PARAMETER["false_easting",500000],
     PARAMETER["false_northing",0],
     UNIT["Meter",1]]
GeoTransform =
   12.19647665061962, 0.0001816592369477914, -3.696047619047622e-05
   43.49892337703098, -2.646787148594408e-05, -0.0001322861904761889
GCP Projection = 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"]]
.....
snip
.....
   TIMEOFDAY=101254443000Z
   CALENDARDATE=20020110
   FUTUREREVIEWDATE=20020312
   SCIENCEREVIEWDATE=20011201
   QAPERCENTMISSINGDATA=0.000006
   QAPERCENTOUTOFBOUNDSDATA=0.000006
   QAPERCENTINTERPOLATEDDATA=0.000000
   REPROCESSINGACTUAL=not reprocessed
   PGEVERSION=04.00R06
   PROCESSINGLEVELID=1B
   MAPPROJECTIONNAME=Universal Transverse Mercator
Corner Coordinates:
Upper Left  (  12.1964767,  43.4989234)
Lower Left  (  12.0412427,  42.9433214)
Upper Right (  13.1011397,  43.3671134)
Lower Right (  12.9459057,  42.8115114)
Center      (  12.5711912,  43.1552174)
Band 1 Block=4980x1 Type=Byte, ColorInterp=Gray
[lor:~] lor%


You see the error at the beginning (libproj.so) but the informations are exact.

Now in Grass I have the same problem.
 From info of Aster file I have a scene in UTM zone 33 projection with 
unit degree (not meters).

I have created a lat lon location because a UTM location has the unit 
in meters.

Now in Grass with r.in.gdal module (Import Raster from Gdal) I enter 
the file name in this format (only subdataset):

	HDF4_SDS:ASTER_L1B:"/ASTER_files/ASTER_FO_gen02/AST_L1B_003_01102002101254_05222002150244.hdf":2

and gdal imports this subdataset but with this error

ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.

I import and I see ASTER files in GRASS but there are not well 
georeferenced. There is an error about lat lon projection and UTM 
zone code. I read the ASTER info and I suppose that this error is in 
gdal but I have not received answer from GDAL mailing list.

Can you help me about projection for ASTER files or about this error 
from gdal????


>P.S.
>I also downloaded the HDFLook program as an alternative, but again, I have the
>unzipped file sitting on my desktop staring at me.  If using that program is
>easier to explain, feel free to let loose if someone knows how.


HDFLook is for HDF MODIS file.
There is OSX version in HDFLOOK site: download it.
There are 2 files: HDFLook and HDFLook.ad
For installing you must read the README file.

 From README file:


HDFLook_MODIS  HDF data files viewer
===================================

	READ AND DISPLAY HDF DATA SETS:
  		-raster images
  		-SDS  ( up to 6 array index, MODIS compress file format)
			(MODIS Quality Control)
		-VDATA

Distribution files
==================


MAPS.tar.Z     		*Coast files and Fonts  used by HDFlook to 
overlap maps on the MODIS images
					-MAPS
					-MAPS/Fonts
HOWTO_HDFLOOK.tar.Z		*Examples: how to use HDFLook in 
background with command files
HDFLOOK_COMMANDS.Z		*Background command files key words description


ENGLISH_MANUAL_HDFLook.ps.gz	*Manuals
FRENCH_MANUAL_HDFLook.ps.gz

LINUX_REDHAT.....HDFLook.tar.gz  *Computer binaries
					-HDFlook
					-HDFLook.ad

cp HDFlook /usr/local/bin
cp HDFLook.ad /usr/lib/X11/app-defaults

=======================


At the first use of HDFLook, the user has to define two environment 
variables with:
- the absolute path of the directory containing the coast, river maps 
data files.
- the absolute path of the directory used temporary files.

	for example: in csh:
        	setenv HDFLOOKMAPS /usr/local/Maps
        	setenv HDFLOOKTMP /usr/tmp
	for example: in sh:
        	HDFLOOKMAPS=/usr/local/Maps ; export HDFLOOKMAPS
		HDFLOOKTMP=/usr/tmp ; export HDFLOOKTMP

Note: if HDFLook is NOT a part of the Msphinx package the user has to 
download the
	MAPS.tar.Z file to get the maps and fonts files

Note: if HDFLook is part of the Msphinx package the  directory 
containing the coast maps
is located under ????/Mfiles/Maps directory


--------------------
Main characteristics
--------------------

    * Visualization of the HDF contents for the following formats:
         o SDS (Scientific Data Set)
         o Vfiles
         o ``Raster images'' 24 bits or 8 bits with look up table.

    * Visualization of slices of data: up to 6 indexes
    * Display of the files attributes
    * Automatic detection of particular filling values (mask)
    * Extraction and dump of binary files stored as simple matrices of (lines
      W columns)
    * Display data sets as ASCII pages of numbers
    * Plot of transects and histograms on image planes
    * Plot of SDS records
    * Production of images and graphics PostScript prints.

--------------------
with command lines
--------------------

    * extract the ancillary data of a SDS.
    * print a PostScript image
    * export (Raw or calibrated) SDS records to binary files
    * export (Raw or calibrated) SDS records to HDF files
    * export RGB images to jpeg files
    * export RGB images to hdf files

         On HDF-EOS MODIS format:

    * build reprojected SDS mosaic to binary files
    * build reprojected RGB mosaic to binary files

         Connected to Msphinx:

    * send to Msphinx all (raw or reprojected) MODIS data and then use the
      Msphinx command lines to build sophisticate outputs.


You must copy 2 files in your directory:

[lor:/download] lor% sudo cp HDFlook /usr/local/bin
[lor:/download] lor% sudo cp HDFLook.ad /usr/lib/X11/app-defaults

enter your root password.

Now you have to set the environment in cshrc file

Open terminal in your home directory (/Users/name_of_user/) and enter:

[lor:~] lor% pico .cshrc

and insert:

# HDFLook
setenv HDFLOOKMAPS /usr/local/Maps
setenv HDFLOOKTMP /usr/tmp

Now you open X11 and enter (or add this command)

[lor:~] lor% /usr/local/bin/HDFLook &

You can open HDF Modis files with all data: you can export in Geotiff 
file from HDF file.
You can open HDF Aster files but it does not read geographic 
information. You can only see the files.
For only viewing HDF file you can use Multispec program 
(http://www.ece.purdue.edu/~biehl/MultiSpec/)

Best regards

-- 
________________________________________________________________________
||      Lorenzo Moretti        e-mail: lorenzo.moretti at bologna.enea.it     
||/|/|  ENEA prot              Web: http://wwwamb.bologna.enea.it/    
||   |  via Don Fiammelli, 2   FTP: ftp://ftpamb.bologna.enea.it/ (ris.)
~~~~~~  40128 BOLOGNA - ITALY  Ph: +39-0516098086  Fax: +39-0516098131
________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20040205/1c367c07/attachment.html


More information about the grass-user mailing list