org.deegree_impl.tools.raster
Class TileImageTree2

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

public class TileImageTree2
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
private static class TileImageTree2.DFileFilter
           
 class TileImageTree2.ProgressObserver
          default progress observer class. write the progress in % to the console
private static class TileImageTree2.UniteGvDesc
           
 
Field Summary
private  int count
           
private  java.lang.String crs
           
private  java.util.HashMap featColl
           
private  boolean geoTiff
           
private  java.awt.image.BufferedImage image
           
private  java.lang.String imageName
           
private  TileImageTree2.ProgressObserver progressObserver
           
private  float quality
           
private  double resx
           
private  double resy
           
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
TileImageTree2(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
 
Method Summary
private  org.w3c.dom.Element addDirectory(int tileWidth, int tileHeight, java.lang.String dirName, double widthCRS, double heightCRS, org.w3c.dom.Element parent)
          adds a new Directory-node to the GVDescriptor XML-document
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
 void createTileImageTree()
          starts the creation of the tiles
private  void createWorldFile(java.lang.String dir, double xmin_, double ymin_, double xmax_, double ymax_, double tilex, double tiley)
           
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.lang.String dir, double x, double y, java.awt.image.BufferedImage img)
          stores one image (tile) in the desired format to the desired target directory.
 void setProgressObserver(TileImageTree2.ProgressObserver progressObserver)
          sets a user defined observer for controling the progress of the tileing
private  void storeEnvelope(java.lang.String dir, double res, double xmin, double ymin, double xmax, double ymax)
           
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 TileImageTree2.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

geoTiff

private boolean geoTiff

featColl

private java.util.HashMap featColl
Constructor Detail

TileImageTree2

public TileImageTree2(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

Method Detail

setProgressObserver

public void setProgressObserver(TileImageTree2.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

storeEnvelope

private void storeEnvelope(java.lang.String dir,
                           double res,
                           double xmin,
                           double ymin,
                           double xmax,
                           double ymax)

createWorldFile

private void createWorldFile(java.lang.String dir,
                             double xmin_,
                             double ymin_,
                             double xmax_,
                             double ymax_,
                             double tilex,
                             double tiley)
                      throws java.lang.Exception
Throws:
java.lang.Exception

saveTile

private java.lang.String saveTile(java.lang.String dir,
                                  double x,
                                  double y,
                                  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

addDirectory

private org.w3c.dom.Element addDirectory(int tileWidth,
                                         int tileHeight,
                                         java.lang.String dirName,
                                         double widthCRS,
                                         double heightCRS,
                                         org.w3c.dom.Element parent)
                                  throws java.lang.Exception
adds a new Directory-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