In a typical WASP scenario:
- WASP lands, and its main flight drive is removed and taken to your ground processing location.
- There, it is mounted onto hercules, where it is shared on the local network via SMB as
ADP.
- The files are initially in ENVI format. We need to translate them into GeoTIFF or Imagine format, so that they can be further processed by the system, or so that people can load up the individual orthos and examine flight data before the big mosaics are produced. You'll do this conversion typically on your laptop, connected to the shared filesystem from hercules.
Your job, then, is
Set Up GDAL On Your Laptop
OS X
We do this via
Mac Ports (this project used to be called Darwin Ports).
Assuming your install of Mac Ports is recent enough, you should be able to configure and build GDAL
and its related tools on your laptop with a single command:
sudo port install gdal
Once installed, you should mess around with the
gdal_translate utility a little bit,
to ensure that things are working as you'd expect.
Linux
Windows XP
Network Configuration
You can connect to the LIAS Ground Station network (where
hercules should
be connected) either through wired or wireless interfaces. Assuming that the
ground station's Linksys hub is being used, you'll be assigned an address via
DHCP automatically. However, if you want to do things manually, take an address
between 192.168.0.30 and 192.168.0.99 --- anything higher is reserved for DHCP,
and anything lower is reserved for static addresses of well known systems.
You likely will not have working name resolution; if so, refer to
hercules by
its numeric IP address: 192.168.0.10
Mounting ADP filesystem
Once
hercules is online with the WASP drive, it will be shared as
ADP on
the local network via SMB. Mount this drive on your laptop:
OS X
From the Finder, hit Apple-K or choose
Connect To Server under the
Go Menu.
Connect to
smb://192.168.0.10/ and select the ADP filesystem.
If a user and password are required, it will
probably be the standard account
used for WASP acitivities, but check with Jason to make sure.
Typically, the new filesystem will be mounted under
/Volumes using the
name of the shared directory. So, from your Terminal, you could get to that
filesystem with something like
cd /Volumes/ADP.
Windows XP
Linux
Converting Files
Typically, someone (like Jason) will give you directories or hierarchies that
need to be converted. There might be an order, a preference, of which
flight legs are converted ahead of others (for example, one leg might have
something interesting in it that people want to see first).
So, you're typically going to be given a directory of ortho'd images
and a file format to convert into. You should also agree to a location
where you're going to store the converted files; it may or may not be
the same directory.
Nota Bene: ENVI uses
.hdr and
.img for its file extensions,
GeoTIFF uses
.tif, and Imagine uses
.img.
Therefore, if you are going to convert ENVI into GeoTIFF, the new files
can be stored alongside the old ones.
But if you are going to convert ENVI to Imagine, then the new files
must be stored in a
different directory, or else you will overwrite the
flight files. You're working on raw flight data, and it hasn't been
copied or backed up yet, so you must be careful.
The typical format of a file conversion is
gdal_translate -of OutputFormat SrcFile DstFile
So, for example, to convert a single file from ENVI to GeoTIFF format,
you might do something like the following. Note that GDAL refers to
the GeoTIFF output format as
GTiff and to Erdas Imagine format
as
HFA. No, I don't know why.
gdal_translate -of GTiff Geo123.img Geo123.tif
Notice a few things about that command. You name the
.img portion
of an ENVI data pair, and GDAL works out the format of that source file.
Also, in that example, we stored the resulting GeoTIFF format in the same
directory. If we were working with Imaging format, you might do something
differently. For example, at one point in the past, we were storing Imagine
files in a subdirectory of the ortho'd imagery. So, in that case, we might
have done
gdal_translate -of HFA Geo123.img Imagine/Geo123.img
Note that both the source and destination files end with
.img.
Annoying, isn't it?
Actually, though, it works in our favor, making life simpler when
we're converting to Imaging format, as you'll see below.
It might be better to store the resulting files in a sibling directory,
rather than a subdirectory.
For example,
gdal_translate -of HFA products/Geo123.img imagine/Geo123.img
From this point on, I'm just going to share some "recipes" for doing these
conversions.
I'll try to give the examples for both kinds of shells. Those lines that start
with a
$ are for Bourne-family shells (sh, ksh, zsh, bash). Those that
start with a
% are for C-family shells (csh, tcsh).
Recipe: Convert all the ENVI files in the current directory to Imagine format,
storing them in another directory. Takes advantage of the fact that both
ENVI and Imagine formats use
.img as their file suffixes.
$ for f in *.img; do
> echo $f
> gdal_translate -of HFA $f ../imagine/$f
> done
% foreach f (*.img)
? echo $f
? gdal_translate -of HFA $f ../imagine/$f
? end
Recipe: Convert all the ENVI files in the current directory to GeoTIFF format,
storing them in the same directory (alongside the source files).
$ for s in *.img; do
> echo $s
> d=`basename $s .img`.tif
> gdal_translate -of GTiff $s $d
> done
% foreach s (*.img)
? echo $s
? set d=`basename $s .img`.tif
? gdal_translate -of GTiff $s $d
? end
Recipe: Convert all the ENVI files in the current directory to Imagine format,
storing them in a different directory named
FOO. Replace
FOO with
whatever directory you want to use: for example,
../imagine
or
/Volumes/ADP/foo or whatever.
$ for f in *.img; do
> echo $f
> gdal_translate -of HFA $f FOO/$f
> done
% foreach f (*.img)
? echo $f
? gdal_translate -of HFA $f FOO/$f
? end
Recipe: Convert all the ENVI files in the current directory to GeoTIFF format,
storing them in a different directory named
FOO. Replace
FOO with
whatever directory you want to use: for example,
../imagine
or
/Volumes/ADP/foo or whatever.
$ for s in *.img; do
> echo $s
> d=`basename $s .img`.tif
> gdal_translate -of GTiff $s FOO/$d
> done
% foreach s (*.img)
? echo $s
? set d=`basename $s .img`.tif
? gdal_translate -of GTiff $s FOO/$d
? end