[ gpsdrive ] noaa charts 11466_1

R. G. Newbury newbury at mandamus.org
Thu Nov 20 17:16:53 AKST 2008


Chris h wrote:
> On Thursday 20 November 2008 19:18:21 Hamish wrote:
> 
> Wow...now that's a tutorial..;)
> 
> Will archive this data on the wiki once tested at this end. 
> 
> Much appreciated and thanks
Chris: if you are keeping this stuff, this is the script I banged up to 
recursively run gdalwarp against all of the KAP files, and save the tif 
files elsewhere. It's not pretty but it works. Could probably do the 
name change and move in one line...
######################################
#!/bin/bash
# no required imputs except the next line and the fifth from the end
cd /where-ever/BSB_ROOT/
rm -f README.txt   # in BSB_ROOT..avoids error message
for dir in *
   do
# only work on directories
   if [ -d $dir ] ; then
     cd $dir
     echo ""
     echo "Changing to folder "
     # So you can see the progress
     pwd
     for file in *.KAP; do
       gdalwarp -t_srs "EPSG:4326" -order 2 -rn $file $file.tif
     done
     # file is now named 1234_1.KAP.tif
     # now change the file name
     for new in *.tif; do
       mv $new ${new%KAP.*}2nd0.tif
     done
     #now copying to tif folder
     for newtif in *.tif; do
       mv -v $newtif /someplace-you-want/tifs/
     done
   cd ..
   fi
done
$#############################




More information about the GPSdrive mailing list