Hi Matteo,
Ok, When I type on the cmd it is something like that
C:\Users\vikram>gdalinfo the output is
'gdalinfo' is not recognised as an internal or external command, 
operable program or batch file.
But I installed FWTools with it command prompt I tried,
C:\Program Files (x86)\FWtools2.4.7. The output is same as you have shown
C:\Program Files (x86)\FWtools2.4.7>gdalinfo
Usage: gdalinfo [--help-general] [-mm] [-stats] [-hist] [-nogcp] [-nomd]
                 [-norat] [-noct] [-checksum] [-mdd domain]* datasetname
I tried to change the path of cmd  to C:\Program/ Files (x86), to 
Program Files, to C:\ , to C:\Windows\sysWOW64\ but the output is
'gdalinfo' is not recognised as an internal or external command, 
operable program or batch file.

Thank you very much Matteo for your work.

Regards,

Vikram.

On 1/27/2012 1:56 PM, Matteo Mattiuzzi wrote:
> Hi Vikram, I had to leave yesterday but I'm back at office now,
> please post always the exact console outputs. The output of 
> 'gdalinfo' should be something like that:
> C:\>gdalinfo
> Usage: gdalinfo [--help-general] [-mm] [-stats] [-hist] [-nogcp] [-nomd]
>                 [-norat] [-noct] [-checksum] [-mdd domain]* datasetname
> Firts of all make sure your _path to gdal_ is set proprerly! Then try 
> 'gdalinfo' (and 'gdalinfo --version' and copy/paste the outputs).
> On Windows I can extract the SDS. But I can't create the raster 
> file...(I could immagine an OS-specific difference in the handling of 
> slashes or quotation marks in the raster or the rgdal package, I'll 
> try to find out)
> AST <- "c:/AST_09_00304012003053127_20120124074826_13837.hdf"
> sds <- getSDS(AST) # this works and it means that GDAL is able to open 
> a HDF4 file under Windows
> sds
> $SDSnames
> [1] "Band1"         "Band2"         "Band3N"        "QA_DataPlane"  
> "QA_DataPlane2"
> $SDS4gdal
> [1] 
> "HDF4_EOS:EOS_SWATH:\"c:/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:Band1" 
>
> [2] 
> "HDF4_EOS:EOS_SWATH:\"c:/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:Band2" 
>
> [3] 
> "HDF4_EOS:EOS_SWATH:\"c:/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:Band3N" 
>
> [4] 
> "HDF4_EOS:EOS_SWATH:\"c:/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:QA_DataPlane" 
>
> [5] 
> "HDF4_EOS:EOS_SWATH:\"c:/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:QA_DataPlane2"
> > b1 <- raster(sds$SDS4gdal[1])
> Error in .rasterObjectFromFile(x, band = band, objecttype = 
> "RasterLayer",  :
>   .rasterObjectFromFile. (file does not exist)
> In addition: Warning message:
> In normalizePath(path.expand(path), winslash, mustWork) :
>   
> path[1]="HDF4_EOS:EOS_SWATH:"c:/AST_09_00304012003053127_20120124074826_13837.hdf":SurfaceRadianceVNIR:Band1": 
> Die Syntax für den Dateinamen, Verzeichnisnamen oder die 
> Datenträgerbezeichnung ist falsch
> > b1
> Error: object 'b1' not found
> ###################
> on Linux
> > AST <- 
> '/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf'
> > sds <- getSDS(AST)
> > sds
> $SDSnames
>  [1] "Band1"         "Band2"         "Band3N"        "QA_DataPlane"
>  [5] "QA_DataPlane2" "0"             "1"             "2"
>  [9] "3"             "4"             "5"             "6"
> $SDS4gdal
>  [1] 
> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:Band1" 
>
>  [2] 
> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:Band2" 
>
>  [3] 
> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:Band3N" 
>
>  [4] 
> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:QA_DataPlane" 
>
>  [5] 
> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":SurfaceRadianceVNIR:QA_DataPlane2"
>  [6] 
> "HDF4_SDS:UNKNOWN:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":0" 
>
>  [7] 
> "HDF4_SDS:UNKNOWN:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":1" 
>
>  [8] 
> "HDF4_SDS:UNKNOWN:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":2" 
>
>  [9] 
> "HDF4_SDS:UNKNOWN:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":3" 
>
> [10] 
> "HDF4_SDS:UNKNOWN:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":4" 
>
> [11] 
> "HDF4_SDS:UNKNOWN:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":5" 
>
> [12] 
> "HDF4_SDS:UNKNOWN:\"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf\":6" 
>
> > b1 <- raster(sds$SDS4gdal[1])
> Warning messages:
> 1: In normalizePath(x) :
>   
> path[1]="HDF4_EOS:EOS_SWATH:"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf":SurfaceRadianceVNIR:Band1": 
> No such file or directory
> 2: In .rasterFromGDAL(x, band = band, objecttype, ...) :
>   GeoTransform values not available; georeferencing will not be correct
> > b1
> class       : RasterLayer
> dimensions  : 4200, 4980, 20916000  (nrow, ncol, ncell)
> resolution  : 1, 1  (x, y)
> extent      : 0, 4980, 0, 4200  (xmin, xmax, ymin, ymax)
> coord. ref. : NA
> values      : 
> HDF4_EOS:EOS_SWATH:"/home/matteo/Desktop/AST_09_00304012003053127_20120124074826_13837.hdf":SurfaceRadianceVNIR:Band1 
>
> min value   : -32768
> max value   : 32767
>
> >>> Vikram Ranga <babuawara@gmail.com> 1/26/2012 5:05 pm >>>
> Hi Matteo,
> I have sent you the aster file through dropbox.
> and i tried your suggestion i.e. with cmd i typed 'gdalinfo' and it 
> says 'gdalinfo' is not recognised.
> I work with windows 7 (64bit)
>
> Regards,
>
> Vikram.
>
> On 1/26/2012 4:28 PM, Matteo Mattiuzzi wrote:
>> Ok please send me a link for getting the asterfile. You are useing a 
>> AST_09 I have tried with a AST_L1B. Probably your file is 
>> a Groudreflectance and hase mayve other namings inside.
>> It is not a Windows/Linux problem, you can open HDF4 files with the 
>> normal GDAL installation under Windows using the path to the SDS.
>> open a console (cmd) and type 'gdalinfo' is gdal in your path? If not 
>> this is the problem
>> if yes type in the console:
>> gdalinfo 
>> 'H:/path/without/spaces/AST_09_00304012003053127_20120124074826_13837.hdf' 
>>
>> I have tried (my AST_L1B file) on Windows XP and it works perfectly.
>> Please send always the outputs...
>> Matteo
>>
>>
>> >>> Matteo Mattiuzzi <matteo.mattiuzzi@boku.ac.at> 1/26/2012 3:53 pm >>>
>> ok should be simple...remove the space in: "c:/new aster" and try again
>>
>> >>> Vikram Ranga <babuawara@gmail.com> 1/26/2012 3:45 pm >>>
>> OK I tried this,
>> sds<-getSDS(HdfName="H:/new 
>> aster/AST_09_00304012003053127_20120124074826_13837.hdf")
>> Warning message:
>> running command 'C:\Windows\system32\cmd.exe /c gdalinfo H:/new 
>> aster/AST_09_00304012003053127_20120124074826_13837.hdf' had status 1
>>  but It is still returning NULL values...
>> >sds
>> $SDSnames
>> NULL
>>
>> $SDS4gdal
>> NULL
>>
>>
>>
>> On 1/26/2012 3:25 PM, Matteo Mattiuzzi wrote:
>>> Ok, I piked a ASTEfile: 
>>> ftp://e4ftl01.cr.usgs.gov/ASTER_B/ASTT/AST_L1B.003/2000.03.30/AST_L1B_00303302000172133_20110111233757_1859.hdf
>>> # I am working on a Linux system I hope it does the same on Windows!!
>>> install.packages("MODIS", repos="http://R-Forge.R-project.org", 
>>> dependencies=TRUE)
>>> library(MODIS)
>>> sds <- getSDS(HdfName= 
>>> "/your/path/to/AST_L1B_00303302000172133_20110111233757_1859.hdf")
>>> SDS$SDS4gdal
>>>  [1] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":VNIR_Swath:ImageData1" 
>>>
>>>  [2] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":VNIR_Swath:ImageData2" 
>>>
>>>  [3] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":VNIR_Swath:ImageData3N"
>>>  [4] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":VNIR_Swath:ImageData3B"
>>>  [5] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData4" 
>>>
>>>  [6] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData5" 
>>>
>>>  [7] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData6" 
>>>
>>>  [8] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData7" 
>>>
>>>  [9] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData8" 
>>>
>>> [10] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":SWIR_Swath:ImageData9" 
>>>
>>> [11] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData10" 
>>>
>>> [12] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData11" 
>>>
>>> [13] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData12" 
>>>
>>> [14] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData13" 
>>>
>>> [15] 
>>> "HDF4_EOS:EOS_SWATH:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":TIR_Swath:ImageData14" 
>>>
>>> [16] 
>>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":0" 
>>>
>>> [17] 
>>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":1" 
>>>
>>> [18] 
>>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":2" 
>>>
>>> [19] 
>>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":3" 
>>>
>>> [20] 
>>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":4" 
>>>
>>> [21] 
>>> "HDF4_SDS:UNKNOWN:\"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf\":5" 
>>>
>>> ...
>>> f1 <- raster(SDS$SDS4gdal[1])
>>> Geospatial Data Abstraction Library extensions to R successfully loaded
>>> Loaded GDAL runtime: GDAL 1.8.0, released 2011/01/12
>>> Path to GDAL shared files: /usr/share/gdal/1.8
>>> Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
>>> Path to PROJ.4 shared files: (autodetected)
>>> Warning messages:
>>> 1: In normalizePath(x) :
>>>   
>>> path[1]="HDF4_EOS:EOS_SWATH:"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf":VNIR_Swath:ImageData1": 
>>> No such file or directory
>>> 2: In .rasterFromGDAL(x, band = band, objecttype, ...) :
>>>   GeoTransform values not available; georeferencing will not be correct
>>> > f1
>>> class       : RasterLayer
>>> dimensions  : 4200, 4980, 20916000  (nrow, ncol, ncell)
>>> resolution  : 1, 1  (x, y)
>>> extent      : 0, 4980, 0, 4200  (xmin, xmax, ymin, ymax)
>>> coord. ref. : NA
>>> values      : 
>>> HDF4_EOS:EOS_SWATH:"/home/matteo/Downloads/AST_L1B_00303302000172133_20110111233757_1859.hdf":VNIR_Swath:ImageData1 
>>>
>>> min value   : 0
>>> max value   : 255
>>> # or
>>> f2 <-stack(SDS$SDS4gdal[1:3])
>>> warning messages...
>>> > f2
>>> class       : RasterStack
>>> dimensions  : 4200, 4980, 20916000, 3  (nrow, ncol, ncell, nlayers)
>>> resolution  : 1, 1  (x, y)
>>> extent      : 0, 4980, 0, 4200  (xmin, xmax, ymin, ymax)
>>> coord. ref. : NA
>>> min values  : 0 0 0
>>> max values  : 255 255 255
>>> The file I have downloaded is a Swath product.... Spatial reference 
>>> is lost and the data is NOT a GRIDDED file (Pixels are not squared 
>>> but more polygons of different size). So you can't do many things 
>>> you could do with an GRID File! ...Maybe you send me a link to 
>>> download the file you are using (if you use d different type!)
>>> Matteo
>>>
>>> >>> Vikram Ranga <babuawara@gmail.com> 1/26/2012 2:55 pm >>>
>>> Hi Matteo,
>>> I am not sure about ASTER is HDF4 or HDF5.
>>> The codes you have given me I tried them
>>> sdsRaw <- shell(paste("gdalinfo ", HdfName,sep=""),intern=TRUE); 
>>> this command seems to be working fine giving "Operable program or 
>>> batch file ". And with raster(sdsRaw[1]) giving error : object 
>>> 'SDSRaw' not found!
>>> While the another two codes does not seems to have worked
>>> SDSnames <- grep(x=sdsRaw,pattern="SUBDATASET_*.._NAME",value=T)
>>> The return with this command is character (0)
>>> SDSnames <- unlist(lapply(SDSnames,function(x) 
>>> strsplit(x,"=")[[1]][2]))
>>> while with this one; the output is NULL.
>>>
>>> Though, I tried to install MODIS library to try getSDS() but could 
>>> not find it in the library(strangely)
>>>
>>> Regards,
>>>
>>> Vikram.
>>>
>>> On 1/26/2012 11:29 AM, Matteo Mattiuzzi wrote:
>>>> Hi Vikram,
>>>>
>>>> Isn't Aster HDF not  an HDF4 format (like MODIS)? HDF4 and HDF5 are 
>>>> not really comparable/compatible each to other.
>>>>
>>>> If I'm right, you can open the file using GDAL, or even with the 
>>>> raster package, but you have to point the path to the layer (SDS) 
>>>> and not only to the file. There was a discussion between Robert 
>>>> Hijmans and Jan Verbesselt about that... 
>>>> https://r-forge.r-project.org/forum/message.php?msg_id=4132&group_id=294
>>>>
>>>> I think you can do the same with ASTER data.
>>>>
>>>> So now the only problem should be how to get the path to the SDS:
>>>> in the MODIS package we use the function: 
>>>> getSDS(HdfName,method='gdal') , try to insert the full FILE-path in 
>>>> that function.
>>>> Or you can try (on windows) with:
>>>> sdsRaw <- shell(paste("gdalinfo ", HdfName,sep=""),intern=TRUE)
>>>> SDSnames <- grep(x=sdsRaw,pattern="SUBDATASET_*.._NAME",value=T)
>>>> SDSnames <- unlist(lapply(SDSnames,function(x) 
>>>> strsplit(x,"=")[[1]][2]))
>>>>
>>>> at least the sdsRaw should work...SDSnames I don't know, just test 
>>>> it (and maybe give me a short feedback)
>>>>
>>>> If everything runs fine you should be able to open in then raster 
>>>> package like that:
>>>>
>>>> SDS1 <-raster(SDSnames[1]) # you can ignore the warning: 
>>>> normalizePath(x)
>>>> or
>>>> sds250 <- stack(SDSnames[1:2]) # FOR MODIS! (only layers with the 
>>>> same resolution are 'stackable')
>>>> ....
>>>>
>>>> Matteo
>>>>
>>>>
>>>> So first you have to determinatate the full path to the SDS you 
>>>> wand to extract.
>>>>
>>>> >>> Vikram Ranga <babuawara@gmail.com> 26.01.12 10.20 Uhr >>>
>>>> Hello Paul,
>>>> sorry for abstruse mail. I am using R version 2.13.2 on windows (64
>>>> bit). I am trying to open ASTER data files(*.hdf). Though, I tried few
>>>> things like readGDAL() and raster() but got error message
>>>> "53127_20120124074826_13837.hdf' not recognised as a supported file
>>>> format" . I tried to load hdf5 package but while installing it I got
>>>> Warning message:
>>>> In getDependencies(pkgs, dependencies, available, lib) : package 
>>>> 'hdf5'
>>>> is not available (for R version 2.13.2). I saw the discussion on hdf
>>>> file on the list with topic "*What is the latest re: reading HDF files
>>>> with R*". In the discussion Roger pointed out that building gdal
>>>> against hdf format might help but I do not have a clue how to do that.
>>>> let me know if you want more info from my end.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Vikram.
>>>>
>>>> On 1/26/2012 10:01 AM, Paul Hiemstra wrote:
>>>> > On 01/26/2012 08:53 AM, Vikram Ranga wrote:
>>>> >> Hello List,
>>>> >> I was trying to open HDF format files.
>>>> >> Though I have followed the discussion on HDF5 format but really cant
>>>> >> figure out as I tried to convert HDF to Geotiff but the tool is not
>>>> >> working on my system. As the package is not for windows my 
>>>> options are
>>>> >> very limited. Can anyone suggest me on this?
>>>> >>
>>>> >>
>>>> >> Regards,
>>>> >>
>>>> >> Vikram.
>>>> >>
>>>> >> _______________________________________________
>>>> >> R-sig-Geo mailing list
>>>> >> R-sig-Geo@r-project.org
>>>> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>> > Hi Vikram,
>>>> >
>>>> > You e-mail is much too vague to yield a good answer. A few questions
>>>> > come to mind:
>>>> >
>>>> > - What is the structure of your HDF files
>>>> > - What "discussion on hdf5 format" do you mean? And where can we find
>>>> > it? It is best to give a summary in your mail what you took out 
>>>> of this
>>>> > discussion.
>>>> > - Show us concretely what you did (code, package etc). What R code
>>>> > failed to load your HDF file, what was the error message it yielded?
>>>> > - What version of R are you using, which package are you using to 
>>>> read
>>>> > the HDF file, what are the versions of those packages. This can be
>>>> > easily provided using the sessionInfo() command.
>>>> >
>>>> > Give us more to work with, or it will be very hard to help you.
>>>> >
>>>> > regards,
>>>> > Paul
>>>> >
>>>>
>>>>     [[alternative HTML version deleted]]
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo@r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

	[[alternative HTML version deleted]]

