I have created a ticket and a patch for this problem http://trac.osgeo.org/gdal/ticket/5119
On Fri, May 31, 2013 at 3:28 PM, Etienne Tourigny <etourigny....@gmail.com>wrote: > > > On Fri, May 31, 2013 at 1:04 PM, Jonathan Greenberg <j...@illinois.edu>wrote: > >> Thanks -- I did notice it was an earlier version (switching to the latest >> OSGeo4W), I apologize for not checking the latest, but as Etienne >> confirmed, the bug seems to be there in the latest as well. The HDF files >> from various sources are so odd when it comes to naming layers, that this >> SDS argument is really helpful (if it would name the files correctly). >> >> Speaking of -sds --> perhaps I can request that gdal_translate allow for >> a layer # flag rather than the full layer name for subdataset files? Is >> this relatively easy to implement (since gdalinfo seems to already have the >> capability)? >> > > that depends on the driver actually... for hdf4 files normal syntax uses > number, whereas the netcdf driver uses variable name (which is more > informative). Changing this behaviour involves tweaking the driver code, > not gdal_translate. > > e.g. > > SUBDATASET_1_NAME=HDF4_SDS:MODIS_L1B:GSUB1.A2001124.0855.003.200219309451.hdf:0 > > SUBDATASET_1_NAME=NETCDF:"sst.nc":lon_bnds > > Now perhaps you mean to select a single dataset by number, without the > full SUBDATASET_X_NAME syntax ? > > such as > gdalinfo -subdatset 1 file.hdf > > which would be equivalent to > gdalinfo HDF4_SDS:file.hdf:0 > > that would be marginally handy, but not much as the rest of gdal uses the > driver:file:subdataset syntax. > > >> --j >> >> >> On Thu, May 30, 2013 at 3:50 PM, Etienne Tourigny < >> etourigny....@gmail.com> wrote: >> >>> >>> >>> On Thu, May 30, 2013 at 4:46 PM, Jukka Rahkonen < >>> jukka.rahko...@mmmtike.fi> wrote: >>> >>>> Jonathan Greenberg <jgrn <at> illinois.edu> writes: >>>> >>>> > >>>> > Folks: >>>> > I'm using a Windows install of GDAL 1.7.0 (FWTools) -- when I run: >>>> > >>>> > gdal_translate -sds -of "GTiff" [some.hdf] "myoutput" >>>> > The output filenames do not have the .tif extension. If I set the >>>> output >>>> file to "myoutput.tif", it appends the "layer numbers" to the end of the >>>> file, e.g. myoutput.tif1. Any tricks to getting the naming working >>>> properly >>>> (myoutput1.tif would be what I'd expect)? >>>> >>>> Hi, >>>> >>>> First, acquire more fresh GDAL, current version is 1.10. Use OSGeo4W or >>>> download Windows binaries from http://gisinternals.com/sdk/ >>>> >>> >>> actually the same thing happens with gdal-1.10. I will prepare a bug >>> report and fix. >>> >>> >>>> >>>> >>>> Then, perhaps you should use gdalinfo first for seeing the exact names >>>> of >>>> layers as GDAL understands them and use such a layer name as input >>>> instead >>>> of [some.hdf]. Read usage examples from >>>> http://www.gdal.org/frmt_hdf4.html >>>> >>> >>> the idea of using the -sds argument is to generate an output file for >>> each subdataset, without having to search for subdataset names >>> >>> >>>> >>>> >>>> -Jukka Rahkonen- >>>> >>>> _______________________________________________ >>>> gdal-dev mailing list >>>> gdal-dev@lists.osgeo.org >>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev >>>> >>> >>> >> >> >> -- >> Jonathan A. Greenberg, PhD >> Assistant Professor >> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory >> Department of Geography and Geographic Information Science >> University of Illinois at Urbana-Champaign >> 607 South Mathews Avenue, MC 150 >> Urbana, IL 61801 >> Phone: 217-300-1924 >> http://www.geog.illinois.edu/~jgrn/ >> AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 >> > >
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev