com.mizar.persistence.gdal
Class GdalDemUtils

java.lang.Object
  extended by com.mizar.persistence.gdal.GdalDemUtils

public class GdalDemUtils
extends java.lang.Object


Constructor Summary
protected GdalDemUtils()
           
 
Method Summary
static java.util.List<java.lang.String> aspect(java.io.File inDir, java.io.File outDir, java.lang.String inFile, java.lang.String outFile, double[] mbr, java.lang.Boolean trigonometric, java.lang.Boolean zeroForFlat, java.lang.Integer band, java.lang.String format, boolean world, java.lang.String[] nameValues, java.lang.Boolean q)
          This command outputs a 32-bit float raster with values between 0° and 360° representing the azimuth that slopes are facing.
The definition of the azimuth is such that : 0° means that the slope is facing the North, 90° it's facing the East, 180° it's facing the South and 270° it's facing the West (provided that the top of your input raster is north oriented).
static java.util.List<java.lang.String> colorRelief(java.io.File inDir, java.io.File outDir, java.lang.String inFile, java.lang.String outFile, java.lang.String colorTextFile, double[] mbr, java.lang.Boolean alpha, java.lang.Boolean exactColorEntry, java.lang.Boolean nearestColorEntry, java.lang.Integer band, java.lang.String format, boolean world, java.lang.String[] nameValues, java.lang.Boolean q)
          This command outputs a 3-band (RGB) or 4-band (RGBA) raster with values are computed from the elevation and a text-based color configuration file, containing the association between various elevation values and the corresponding wished color.
static java.util.List<java.lang.String> gdalTranslate(java.lang.String inFileName, java.lang.String outFileName, java.lang.String inDir, java.lang.String outDir, java.lang.String outputFormat, double[] mbr)
           
static java.util.List<java.lang.String> hillshade(java.io.File inDir, java.lang.String inFile, java.io.File outDir, java.lang.String[] outFile, double[] mbr, java.lang.Double zFactor, java.lang.Double scale, java.lang.Double azimuth, java.lang.Double altitude, java.lang.Integer band, java.lang.String[] format, boolean world, java.lang.String[] nameValues, java.lang.Boolean q)
          This command outputs an 8-bit raster with a nice shaded relief effect.
static java.util.List<java.lang.String> hillshade(java.io.File inDir, java.lang.String inFile, java.io.File outDir, java.lang.String outFile, double[] mbr, java.lang.Double zFactor, java.lang.Double scale, java.lang.Double azimuth, java.lang.Double altitude, java.lang.Integer band, java.lang.String format, boolean world, java.lang.String[] nameValues, java.lang.Boolean q)
          This command outputs an 8-bit raster with a nice shaded relief effect.
static void main(java.lang.String[] args)
           
static java.util.List<java.lang.String> roughness(java.io.File inDir, java.io.File outDir, java.lang.String inFile, java.lang.String outFile, java.lang.Boolean computeEdges, java.lang.Integer band, java.lang.String format, java.lang.Boolean q)
          This command outputs a single-band raster with values computed from the elevation.
static java.util.List<java.lang.String> slope(java.io.File inDir, java.io.File outDir, java.lang.String inFile, java.lang.String outFile, double[] mbr, java.lang.Boolean percent, int scale, java.lang.Integer band, java.lang.String format, java.lang.String[] nameValues, java.lang.Boolean q)
          This command will take a DEM raster and output a 32-bit float raster with slope values.
static java.util.List<java.lang.String> TPI(java.io.File inDir, java.io.File outDir, java.lang.String inFile, java.lang.String outFile, java.lang.Boolean computeEdges, java.lang.Integer band, java.lang.String format, java.lang.Boolean q)
          This command outputs a single-band raster with values computed from the elevation.
static java.util.List<java.lang.String> TRI(java.io.File inDir, java.io.File outDir, java.lang.String inFile, java.lang.String outFile, java.lang.Boolean computeEdges, java.lang.Integer band, java.lang.String format, java.lang.Boolean q)
          This command outputs a single-band raster with values computed from the elevation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GdalDemUtils

protected GdalDemUtils()
Method Detail

gdalTranslate

public static java.util.List<java.lang.String> gdalTranslate(java.lang.String inFileName,
                                                             java.lang.String outFileName,
                                                             java.lang.String inDir,
                                                             java.lang.String outDir,
                                                             java.lang.String outputFormat,
                                                             double[] mbr)
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

hillshade

public static java.util.List<java.lang.String> hillshade(java.io.File inDir,
                                                         java.lang.String inFile,
                                                         java.io.File outDir,
                                                         java.lang.String outFile,
                                                         double[] mbr,
                                                         java.lang.Double zFactor,
                                                         java.lang.Double scale,
                                                         java.lang.Double azimuth,
                                                         java.lang.Double altitude,
                                                         java.lang.Integer band,
                                                         java.lang.String format,
                                                         boolean world,
                                                         java.lang.String[] nameValues,
                                                         java.lang.Boolean q)
                                                  throws java.lang.Exception
This command outputs an 8-bit raster with a nice shaded relief effect. It’s very useful for visualizing the terrain. You can optionally specify the azimuth and altitude of the light source, a vertical exaggeration factor and a scaling factor to account for differences between vertical and horizontal units.

Parameters:
inDir - optional, the directory that input files will be found in and from where gdaldem will be run
outDir - optional, the directory that output files will be written to
inFile - the name of the source file
outFile - the name of the destination file
zFactor - optional, vertical exageration, defaults to 1
scale - optional, x:y scale defaults to 1 (use 370400 for ft:lat/long and 111120 for m:lat/long)
azimuth - optional, defaults to 315
altitude - optional, altitude of the light in degrees, defaults to 45
band - optional, the input band to be processed, defaults to 1
format - optional, defaults to GeoTIFF (GTiff). Use the short format name.
nameValues - optional
q - defaults to true which suppresses narrative output
Returns:
the output from the gdaldem run
Throws:
java.lang.Exception
See Also:
CommandRunner

hillshade

public static java.util.List<java.lang.String> hillshade(java.io.File inDir,
                                                         java.lang.String inFile,
                                                         java.io.File outDir,
                                                         java.lang.String[] outFile,
                                                         double[] mbr,
                                                         java.lang.Double zFactor,
                                                         java.lang.Double scale,
                                                         java.lang.Double azimuth,
                                                         java.lang.Double altitude,
                                                         java.lang.Integer band,
                                                         java.lang.String[] format,
                                                         boolean world,
                                                         java.lang.String[] nameValues,
                                                         java.lang.Boolean q)
                                                  throws java.lang.Exception
This command outputs an 8-bit raster with a nice shaded relief effect. It’s very useful for visualizing the terrain. You can optionally specify the azimuth and altitude of the light source, a vertical exaggeration factor and a scaling factor to account for differences between vertical and horizontal units.

Parameters:
inDir - optional, the directory that input files will be found in and from where gdaldem will be run
outDir - optional, the directory that output files will be written to
inFile - the name of the source file
outFile - the names of the destination files
zFactor - optional, vertical exageration, defaults to 1
scale - optional, x:y scale defaults to 1 (use 370400 for ft:lat/long and 111120 for m:lat/long)
azimuth - optional, defaults to 315
altitude - optional, altitude of the light in degrees, defaults to 45
band - optional, the input band to be processed, defaults to 1
format - optional, defaults to GeoTIFF (GTiff). Use the short format name. The formats specified need to be in the same order as the outFile names
nameValues - optional
q - defaults to true which suppresses narrative output
Returns:
the output from the gdaldem run
Throws:
java.lang.Exception
See Also:
CommandRunner

slope

public static java.util.List<java.lang.String> slope(java.io.File inDir,
                                                     java.io.File outDir,
                                                     java.lang.String inFile,
                                                     java.lang.String outFile,
                                                     double[] mbr,
                                                     java.lang.Boolean percent,
                                                     int scale,
                                                     java.lang.Integer band,
                                                     java.lang.String format,
                                                     java.lang.String[] nameValues,
                                                     java.lang.Boolean q)
                                              throws java.lang.Exception
This command will take a DEM raster and output a 32-bit float raster with slope values. You have the option of specifying the type of slope value you want: degrees or percent slope. In cases where the horizontal units differ from the vertical units, you can also supply a scaling factor.

Parameters:
inDir - optional, the directory that input files will be found in and from where gdaldem will be run
outDir - optional, the directory that output files will be written to
inFile - the name of the source file
outFile - the name of the destination file
percent - if true then the slope will be expressed in percent slope, default is degrees
scale - optional, x:y scale defaults to 1 (use 370400 for ft:lat/long and 111120 for m:lat/long)
band - optional, the input band to be processed, defaults to 1
format - optional, defaults to GeoTIFF (GTiff). Use the short format name.
nameValues - optional
q - defaults to true which suppresses narrative output
Returns:
the output from the gdaldem run
Throws:
java.lang.Exception
See Also:
CommandRunner

aspect

public static java.util.List<java.lang.String> aspect(java.io.File inDir,
                                                      java.io.File outDir,
                                                      java.lang.String inFile,
                                                      java.lang.String outFile,
                                                      double[] mbr,
                                                      java.lang.Boolean trigonometric,
                                                      java.lang.Boolean zeroForFlat,
                                                      java.lang.Integer band,
                                                      java.lang.String format,
                                                      boolean world,
                                                      java.lang.String[] nameValues,
                                                      java.lang.Boolean q)
                                               throws java.lang.Exception
This command outputs a 32-bit float raster with values between 0° and 360° representing the azimuth that slopes are facing.
The definition of the azimuth is such that : (provided that the top of your input raster is north oriented).
The aspect value -9999 is used as the nodata value to indicate undefined aspect in flat areas with slope=0.

Parameters:
inDir - optional, the directory that input files will be found in and from where gdaldem will be run
outDir - optional, the directory that output files will be written to
inFile - the name of the source file
outFile - the name of the destination file
trigonometric - return trignometric angle instead of azimuth. Thus 0 meand East, 90 North, 180 West, & 270 South
zeroForFlat - return 0 for flat areas with slope of 9, instead of -9999
band - optional, the input band to be processed, defaults to 1
format - optional, defaults to GeoTIFF (GTiff). Use the short format name.
nameValues - optional
q - defaults to true which suppresses narrative output
Returns:
the output from the gdaldem run
Throws:
java.lang.Exception
See Also:
CommandRunner

colorRelief

public static java.util.List<java.lang.String> colorRelief(java.io.File inDir,
                                                           java.io.File outDir,
                                                           java.lang.String inFile,
                                                           java.lang.String outFile,
                                                           java.lang.String colorTextFile,
                                                           double[] mbr,
                                                           java.lang.Boolean alpha,
                                                           java.lang.Boolean exactColorEntry,
                                                           java.lang.Boolean nearestColorEntry,
                                                           java.lang.Integer band,
                                                           java.lang.String format,
                                                           boolean world,
                                                           java.lang.String[] nameValues,
                                                           java.lang.Boolean q)
                                                    throws java.lang.Exception
This command outputs a 3-band (RGB) or 4-band (RGBA) raster with values are computed from the elevation and a text-based color configuration file, containing the association between various elevation values and the corresponding wished color. By default, the colors between the given elevation values are blended smoothly and the result is a nice colorized DEM. The -exact_color_entry or -nearest_color_entry options can be used to avoid that linear interpolation for values that don't match an index of the color configuration file.

The color-relief mode is the only mode that supports VRT as output format. In that case, it will translate the color configuration file into appropriate LUT elements. Note that elevations specified as percentage will be translated as absolute values, which must be taken into account when the statistics of the source raster differ from the one that was used when building the VRT.

The text-based color configuration file generally contains 4 columns per line : the elevation value and the corresponding Red, Green, Blue component (between 0 and 255). The elevation value can be any floating point value, or the nv keyword for the nodata value. The elevation can also be expressed as a percentage : 0% being the minimum value found in the raster, 100% the maximum value.

An extra column can be optionnaly added for the alpha component. If it is not specified, full opacity (255) is assumed.

Various field separators are accepted : comma, tabulation, spaces, ':'.

Common colors used by GRASS can also be specified by using their name, instead of the RGB triplet. The supported list is : white, black, red, green, blue, yellow, magenta, cyan, aqua, grey/gray, orange, brown, purple/violet and indigo.

Note: the syntax of the color configuration file is derived from the one supported by GRASS r.colors utility. ESRI HDR color table files (.clr) also match that syntax. The alpha component and the support of tablulations and commma as separators are GDAL specific extensions.

For example :

Parameters:
inDir - optional, the directory that input files will be found in and from where gdaldem will be run
outDir - optional, the directory that output files will be written to
inFile - the name of the source file
outFile - the name of the destination file
colorTextFile - text-based color configuration file
mbr - minimum bounding rectange of color relief input area.
alpha - add an alpha channel to the output raster
exactColorEntry - use strict matching when searching in the color configuration file. If none matching color entry is found, the "0,0,0,0" RGBA quadruplet will be used
nearestColorEntry - use the RGBA quadruplet corresponding to the closest entry in the color configuration file.
band - optional, the input band to be processed, defaults to 1
format - optional, defaults to GeoTIFF (GTiff). Use the short format name.
nameValues - optional
q - defaults to true which suppresses narrative output
Returns:
the output from the gdaldem run
Throws:
java.lang.Exception
See Also:
CommandRunner

TRI

public static java.util.List<java.lang.String> TRI(java.io.File inDir,
                                                   java.io.File outDir,
                                                   java.lang.String inFile,
                                                   java.lang.String outFile,
                                                   java.lang.Boolean computeEdges,
                                                   java.lang.Integer band,
                                                   java.lang.String format,
                                                   java.lang.Boolean q)
This command outputs a single-band raster with values computed from the elevation. TRI stands for Terrain Ruggedness Index, which is defined as the mean difference between a central pixel and its surrounding cells (see Wilson et al 2007, Marine Geodesy 30:3-35).

Parameters:
inDir - optional, the directory that input files will be found in and from where gdaldem will be run
outDir - optional, the directory that output files will be written to
inFile - the name of the source file
outFile - the name of the destination file
computeEdges - (GDAL version 1.8.0+ Do the computation at raster edges and near nodata values
band - optional, the input band to be processed, defaults to 1
format - optional, defaults to GeoTIFF (GTiff). Use the short format name.
q - defaults to true which suppresses narrative output
Returns:
the output from the gdaldem run
See Also:
CommandRunner

TPI

public static java.util.List<java.lang.String> TPI(java.io.File inDir,
                                                   java.io.File outDir,
                                                   java.lang.String inFile,
                                                   java.lang.String outFile,
                                                   java.lang.Boolean computeEdges,
                                                   java.lang.Integer band,
                                                   java.lang.String format,
                                                   java.lang.Boolean q)
This command outputs a single-band raster with values computed from the elevation. TPI stands for Topographic Position Index, which is defined as the difference between a central pixel and the mean of its surrounding cells (see Wilson et al 2007, Marine Geodesy 30:3-35).

Parameters:
inDir - optional, the directory that input files will be found in and from where gdaldem will be run
outDir - optional, the directory that output files will be written to
inFile - the name of the source file
outFile - the name of the destination file
computeEdges - (GDAL version 1.8.0+ Do the computation at raster edges and near nodata values
band - optional, the input band to be processed, defaults to 1
format - optional, defaults to GeoTIFF (GTiff). Use the short format name.
q - defaults to true which suppresses narrative output
Returns:
the output from the gdaldem run
See Also:
CommandRunner

roughness

public static java.util.List<java.lang.String> roughness(java.io.File inDir,
                                                         java.io.File outDir,
                                                         java.lang.String inFile,
                                                         java.lang.String outFile,
                                                         java.lang.Boolean computeEdges,
                                                         java.lang.Integer band,
                                                         java.lang.String format,
                                                         java.lang.Boolean q)
This command outputs a single-band raster with values computed from the elevation. Roughness is the the largest inter-cell difference of a central pixel and its surrounding cell, as defined in Wilson et al (2007, Marine Geodesy 30:3-35).

Parameters:
inDir - optional, the directory that input files will be found in and from where gdaldem will be run
outDir - optional, the directory that output files will be written to
inFile - the name of the source file
outFile - the name of the destination file
computeEdges - (GDAL version 1.8.0+ Do the computation at raster edges and near nodata values
band - optional, the input band to be processed, defaults to 1
format - optional, defaults to GeoTIFF (GTiff). Use the short format name.
q - defaults to true which suppresses narrative output
Returns:
the output from the gdaldem run
See Also:
CommandRunner

main

public static void main(java.lang.String[] args)