[Gdal-dev] Landsat 7 data

Frank Warmerdam warmerdam at pobox.com
Wed Mar 12 10:27:12 EST 2003

Andrey Kiselev wrote:
> On Wed, Mar 12, 2003 at 03:56:05PM +0100, Horst Reinecke wrote:
>>>You have normal FAST L7 dataset. Your headers are work for me. Could you
>>>show output of `ls' command in the directory where the dataset is?
>>'ls' shows:
>>index.txt					l71169072_07220001009_hpn.fst
>>l71169072_07220001009_b10.fst		l71169072_07220001009_hrf.fst
>>l71169072_07220001009_b20.fst		l71169072_07220001009_htm.fst
>>l71169072_07220001009_b30.fst		l71169072_07220001009_b62.fst	
>>l71169072_07220001009_b40.fst		l71169072_07220001009_b70.fst
>>l71169072_07220001009_b50.fst		l71169072_07220001009_b80.fst	
>>l71169072_07220001009_b61.fst		readme.ff7
> Huh! it is clear now. You have files named in low case. Note, that FAST
> headers contain _exact_ band filenames and you should have raw files with
> the same names as in header. Rename them with something like:
> #!/bin/sh                                                                       
> for oldfilename in *
> do                                                                              
>         newfilename=`echo $oldfilename | tr [:lower:] [:upper:]`                
>         if [ ! $oldfilename == $newfilename ]; then                             
>             mv $oldfilename $newfilename                                        
>             echo $oldfilename $newfilename                                      
>         fi                                                                      
> done


Note that some GDAL drivers have explicit logic to try lower or upper case
versions of names in addition to the default so that names which are "case
modified" on unix systems will still work.  You might want to try using
the CPLFormCIFilename() function which will try to do this.

  * Case insensitive file searching, returing full path.
  * This function tries to return the path to a file regardless of
  * whether the file exactly matches the basename, and extension case, or
  * is all upper case, or all lower case.  The path is treated as case
  * sensitive.  This function is equivelent to CPLFormFilename() on
  * case insensitive file systems (like Windows).
  * @param pszPath directory path to the directory containing the file.  This
  * may be relative or absolute, and may have a trailing path separator or
  * not.  May be NULL.
  * @param pszBasename file basename.  May optionally have path and/or
  * extension.  May not be NULL.
  * @param pszExtension file extension, optionally including the period.  May
  * be NULL.
  * @return a fully formed filename in an internal static string.  Do not
  * modify or free the returned string.  The string may be destroyed by the
  * next CPL call.

const char *CPLFormCIFilename( const char * pszPath,
                                const char * pszBasename,
                                const char * pszExtension )

This would help avoid this kind of problem in the future.

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the Gdal-dev mailing list