Geoscience Reference
In-Depth Information
extract the number of samples (columns) in an image and assign it to some variable
NSAMPLE for later use. The output format used by gdalinfo requires some parsing
on the command line using the Bash grep command and the stream editor sed .
Both are installed by default in Linux.
NSAMPLE=$(gdalinfo LC82070232013160LGN00.tif|grep 'Size is'| sed
's/.* \([0-9]*\),.*/\1/')
Similarly, the number of lines can be obtained as:
NLINE=$(gdalinfo LC82070232013160LGN00.tif|grep 'Size is'| sed
's/.*, \([0-9]*\)/\1/')
5.2 gdalmanage
With gdalmanage you can find (scan), copy, rename and delete raster files.
These functionalities can be performed using operating system commands as well.
Nevertheless, this program offers some more flexibility as will be shown in the
examples below. Particularly useful is the identify mode, which allows you to
recursively search your directories for raster data files.
Usage: gdalmanage identify [-r] [-u] files*
or gdalmanage copy [-f driver] oldname newname
or gdalmanage rename [-f driver] oldname newname
or gdalmanage delete [-f driver] datasetname
-r
Recursively scan files/folders for raster files.
-u
Report failures if file type is unidentified.
-f format
Specify format of raster file if unknown by the application. Uses short data format
name (e.g. GTiff).
datasetname
Raster file to operate on.
newdatasetname
For copy and rename modes, you provide a source filename and a target filename,
just like copy and move commands in an operating system.
 
 
Search WWH ::




Custom Search