org.deegree_impl.tools.raster
Class TileImageTree

java.lang.Object
  extended byorg.deegree_impl.tools.raster.TileImageTree

public class TileImageTree
extends java.lang.Object

The program creates a pyramidal structure for a geo-referenced image and splits each level of the 'pyramid' into several tiles. The tiles will be arranged into a Quad-Tree datastructure. The description of this datastructure will be stored into a XML-document that is conform to the deegree coverage descriptor format. (see CVDescriptor.xsd). So the result of the tileing can directly be use with the deegree GridCoverage and Web Coverage Service implementations for fast access to large amounts of raster data.

----------------------------------------------------------------------

Version:
27.12.2002
Author:
Andreas Poth

Nested Class Summary
 class TileImageTree.ProgressObserver
          default progress observer class. write the progress in % to the console
 
Field Summary
private  int count
           
private  java.lang.String crs
           
private  boolean geoTiff
           
private  java.awt.image.BufferedImage image
           
private  java.lang.String imageName
           
private  TileImageTree.ProgressObserver progressObserver
           
private  float quality
           
private  double resx
           
private  double resy
           
private  int startIndex
           
private  java.lang.String targetDir
           
private  java.lang.String targetFormat
           
protected  double[] targetResolutions
           
private  double xmax
           
private  double xmin
           
private  double ymax
           
private  double ymin
           
 
Constructor Summary
TileImageTree(java.lang.String imageSource, java.lang.String targetDir, java.lang.String targetFormat, double[] targetResolutions, int startIndex, float quality, java.lang.String crs)
          Creates a new instance of TileImageTree
TileImageTree(java.lang.String imageSource, java.lang.String targetDir, java.lang.String targetFormat, double[] targetResolutions, int startIndex, float quality, java.lang.String crs, double minx, double miny, double maxx, double maxy)
          Creates a new instance of TileImageTree
 
Method Summary
private  void addGridCoverageLayer(org.w3c.dom.Node node, java.lang.String layerID, java.lang.String title, java.lang.String crs, double llminx, double llminy, double llmaxx, double llmaxy, double minx, double miny, double maxx, double maxy, double width, int height)
          adds a new grid coverage layer to a WCS
private  org.w3c.dom.Element addNode(double xmin, double ymin, double xmax, double ymax, java.lang.String file, org.w3c.dom.Element parent)
          adds a new Tile-node to the GVDescriptor XML-document
 void createTileImageTree()
          starts the creation of the tiles
private  boolean isGeoTIFFFormat(RenderedOp rop)
          description: the following TIFFKeys count as indicator if a TIFF-File carries GeoTIFF information: ModelPixelScaleTag = 33550 (SoftDesk) ModelTransformationTag = 34264 (JPL Carto Group) ModelTiepointTag = 33922 (Intergraph) GeoKeyDirectoryTag = 34735 (SPOT) GeoDoubleParamsTag = 34736 (SPOT) GeoAsciiParamsTag = 34737 (SPOT) implementation status: working
private  java.awt.image.BufferedImage loadImage(java.lang.String imageSource)
          loads the base image
static void main(java.lang.String[] args)
           
private static void printHelp()
           
private  void readBBoxFromGeoTIFF(RenderedOp rop)
          description: Extracts the GeoKeys of the GeoTIFF.
private  void readWorldFile(java.lang.String filename)
          Gets the latitude and longitude coordinates (xmin, ymin, xmax and ymax) of the image.
private  java.lang.String saveTile(java.awt.image.BufferedImage img)
          stores one image (tile) in the desired format to the desired target directory.
 void setProgressObserver(TileImageTree.ProgressObserver progressObserver)
          sets a user defined observer for controling the progress of the tileing
private  void tile(java.awt.image.BufferedImage img, double xmin, double ymin, double xmax, double ymax, int res, org.w3c.dom.Element parent)
          the method performes the creation of the tiles and the filling of the quadtree XML-document. the method will be call in a recursion for each defined level (scale).
private static boolean validate(java.util.HashMap map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

image

private java.awt.image.BufferedImage image

progressObserver

private TileImageTree.ProgressObserver progressObserver

crs

private java.lang.String crs

imageName

private java.lang.String imageName

targetDir

private java.lang.String targetDir

targetFormat

private java.lang.String targetFormat

targetResolutions

protected double[] targetResolutions

resx

private double resx

resy

private double resy

xmax

private double xmax

xmin

private double xmin

ymax

private double ymax

ymin

private double ymin

quality

private float quality

count

private int count

startIndex

private int startIndex

geoTiff

private boolean geoTiff
Constructor Detail

TileImageTree

public TileImageTree(java.lang.String imageSource,
                     java.lang.String targetDir,
                     java.lang.String targetFormat,
                     double[] targetResolutions,
                     int startIndex,
                     float quality,
                     java.lang.String crs)
              throws java.lang.Exception
Creates a new instance of TileImageTree


TileImageTree

public TileImageTree(java.lang.String imageSource,
                     java.lang.String targetDir,
                     java.lang.String targetFormat,
                     double[] targetResolutions,
                     int startIndex,
                     float quality,
                     java.lang.String crs,
                     double minx,
                     double miny,
                     double maxx,
                     double maxy)
              throws java.lang.Exception
Creates a new instance of TileImageTree

Method Detail

setProgressObserver

public void setProgressObserver(TileImageTree.ProgressObserver progressObserver)
sets a user defined observer for controling the progress of the tileing


loadImage

private java.awt.image.BufferedImage loadImage(java.lang.String imageSource)
                                        throws java.lang.Exception
loads the base image

Throws:
java.lang.Exception

isGeoTIFFFormat

private boolean isGeoTIFFFormat(RenderedOp rop)
description: the following TIFFKeys count as indicator if a TIFF-File carries GeoTIFF information: ModelPixelScaleTag = 33550 (SoftDesk) ModelTransformationTag = 34264 (JPL Carto Group) ModelTiepointTag = 33922 (Intergraph) GeoKeyDirectoryTag = 34735 (SPOT) GeoDoubleParamsTag = 34736 (SPOT) GeoAsciiParamsTag = 34737 (SPOT) implementation status: working


createTileImageTree

public void createTileImageTree()
                         throws java.lang.Exception
starts the creation of the tiles

Throws:
java.lang.Exception

tile

private void tile(java.awt.image.BufferedImage img,
                  double xmin,
                  double ymin,
                  double xmax,
                  double ymax,
                  int res,
                  org.w3c.dom.Element parent)
           throws java.lang.Exception
the method performes the creation of the tiles and the filling of the quadtree XML-document. the method will be call in a recursion for each defined level (scale).

Throws:
java.lang.Exception

saveTile

private java.lang.String saveTile(java.awt.image.BufferedImage img)
                           throws java.lang.Exception
stores one image (tile) in the desired format to the desired target directory.

Throws:
java.lang.Exception

addNode

private org.w3c.dom.Element addNode(double xmin,
                                    double ymin,
                                    double xmax,
                                    double ymax,
                                    java.lang.String file,
                                    org.w3c.dom.Element parent)
                             throws java.lang.Exception
adds a new Tile-node to the GVDescriptor XML-document

Throws:
java.lang.Exception

readWorldFile

private void readWorldFile(java.lang.String filename)
                    throws java.lang.Exception
Gets the latitude and longitude coordinates (xmin, ymin, xmax and ymax) of the image.

Throws:
java.lang.Exception

readBBoxFromGeoTIFF

private void readBBoxFromGeoTIFF(RenderedOp rop)
                          throws java.lang.Exception
description: Extracts the GeoKeys of the GeoTIFF. The Following Tags will be extracted(http://www.remotesensing.org/geotiff/spec/geotiffhome.html): ModelPixelScaleTag = 33550 (SoftDesk) ModelTiepointTag = 33922 (Intergraph) implementation status: working

Throws:
java.lang.Exception

addGridCoverageLayer

private void addGridCoverageLayer(org.w3c.dom.Node node,
                                  java.lang.String layerID,
                                  java.lang.String title,
                                  java.lang.String crs,
                                  double llminx,
                                  double llminy,
                                  double llmaxx,
                                  double llmaxy,
                                  double minx,
                                  double miny,
                                  double maxx,
                                  double maxy,
                                  double width,
                                  int height)
                           throws java.lang.Exception
adds a new grid coverage layer to a WCS

Throws:
java.lang.Exception

printHelp

private static void printHelp()

validate

private static boolean validate(java.util.HashMap map)
Parameters:
map -
Returns:

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments