org.deegree.coverage.raster.io
Class RasterIOOptions

java.lang.Object
  extended by org.deegree.coverage.raster.io.RasterIOOptions
All Implemented Interfaces:
Serializable

public class RasterIOOptions
extends Object
implements Serializable

This class is a container for various RasterIO options.

Version:
$Revision: 31644 $, $Date: 2011-08-24 22:27:43 +0200 (Wed, 24 Aug 2011) $
Author:
Oliver Tonnhofer, last edited by: $Author: mschneider $
See Also:
Serialized Form

Field Summary
static String CREATE_RASTER_MISSING_CACHE_DIR
          A key to signal the creation of missing raster dirs.
static String CRS
          This key will get the crs of the raster.
static String DATA_LOADING_POLICY
          This key will get the default loading policy (resulting in a RasterDataContainer) of the RasterDataFactory.
static String GEO_ORIGIN_LOCATION
          This key will get the location of the origin of a raster geo reference see RasterGeoReference.OriginLocation
static String IMAGE_INDEX
          which image index to use (eg. for tiffs with overviews)
static String LOCAL_RASTER_CACHE_DIR
          This key will get the local raster cache directory to be used inside the raster cache directory for the given raster.
static String OPT_FORMAT
          This key stores the (output) format.
static String OPT_TEXT_SEPARATOR
          Separator for text base files
static String ORIGIN_OF_RASTER
          Use this key to add the origin of the raster read, this might be handy if reading rasters from an URL (Stream) and the cache can use this id to load data from cache.
static String RASTER_CACHE_DIR
          The raster cache dir to be used.
static String READ_WLD_FILE
          This key is contained if the RasterReader should try to read the world file.
 
Constructor Summary
RasterIOOptions()
          An empty constructor, nothing is set.
RasterIOOptions(RasterGeoReference.OriginLocation originLocation)
           
RasterIOOptions(RasterGeoReference reference)
          Use this constructor if you read your raster reference some place else, or if you are reading from a stream.
RasterIOOptions(RasterGeoReference ref, String format)
          Set the default loading policy to one configured in the RasterDataContainerFactory
 
Method Summary
 void add(String key, String value)
           
 boolean contains(String key)
           
 RasterIOOptions copyOf(RasterIOOptions otherOptions)
          Copies the the values from the given options.
static byte[] createNoData(String[] bandValues, DataType type)
          Create a noData array from the given strings.
static RasterIOOptions forFile(File file)
          Return a RasterIOOption object with the format set according to the given file.
static RasterIOOptions forFile(File file, RasterGeoReference envelope)
          Return a RasterIOOption object with the format set according to the given file with an optional RasterGeoReference.
 String get(String key)
           
 ICRS getCRS()
           
 RasterDataContainerFactory.LoadingPolicy getLoadingPolicy()
           
 byte[] getNoDataValue()
          Returns the no data value.
 RasterGeoReference getRasterGeoReference()
           
 RasterGeoReference.OriginLocation getRasterOriginLocation()
           
 boolean hasRasterGeoReference()
           
 boolean readWorldFile()
           
 void setNoData(byte[] noDataValue)
          no data value.
 void setRasterGeoReference(RasterGeoReference geoRef)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPT_TEXT_SEPARATOR

public static final String OPT_TEXT_SEPARATOR
Separator for text base files

See Also:
Constant Field Values

OPT_FORMAT

public static final String OPT_FORMAT
This key stores the (output) format.

See Also:
Constant Field Values

READ_WLD_FILE

public static final String READ_WLD_FILE
This key is contained if the RasterReader should try to read the world file.

See Also:
Constant Field Values

DATA_LOADING_POLICY

public static final String DATA_LOADING_POLICY
This key will get the default loading policy (resulting in a RasterDataContainer) of the RasterDataFactory.

See Also:
Constant Field Values

GEO_ORIGIN_LOCATION

public static final String GEO_ORIGIN_LOCATION
This key will get the location of the origin of a raster geo reference see RasterGeoReference.OriginLocation

See Also:
Constant Field Values

CRS

public static final String CRS
This key will get the crs of the raster.

See Also:
Constant Field Values

IMAGE_INDEX

public static final String IMAGE_INDEX
which image index to use (eg. for tiffs with overviews)

See Also:
Constant Field Values

LOCAL_RASTER_CACHE_DIR

public static final String LOCAL_RASTER_CACHE_DIR
This key will get the local raster cache directory to be used inside the raster cache directory for the given raster. For example the raster cache directory is /tmp/ and the LOCAL_RASTER_CACHE_DIR is set to 'some_name' all raster caches will reside in /tmp/some_name/

See Also:
Constant Field Values

RASTER_CACHE_DIR

public static final String RASTER_CACHE_DIR
The raster cache dir to be used.

See Also:
Constant Field Values

CREATE_RASTER_MISSING_CACHE_DIR

public static final String CREATE_RASTER_MISSING_CACHE_DIR
A key to signal the creation of missing raster dirs.

See Also:
Constant Field Values

ORIGIN_OF_RASTER

public static final String ORIGIN_OF_RASTER
Use this key to add the origin of the raster read, this might be handy if reading rasters from an URL (Stream) and the cache can use this id to load data from cache.

See Also:
Constant Field Values
Constructor Detail

RasterIOOptions

public RasterIOOptions()
An empty constructor, nothing is set. The loading policy is the default value taken from the RasterDataContainerFactory. Worldfile reading is on.


RasterIOOptions

public RasterIOOptions(RasterGeoReference reference)
Use this constructor if you read your raster reference some place else, or if you are reading from a stream. Be aware to set the filetype of the data as well. The loading policy is the default value taken from the RasterDataContainerFactory.

Parameters:
reference - of the file/stream to read.

RasterIOOptions

public RasterIOOptions(RasterGeoReference ref,
                       String format)
Set the default loading policy to one configured in the RasterDataContainerFactory

Parameters:
ref -
format - of the raster to read, e.g. png, jpg, tiff..., may be null

RasterIOOptions

public RasterIOOptions(RasterGeoReference.OriginLocation originLocation)
Parameters:
originLocation - to be used for reading worldfiles.
Method Detail

add

public void add(String key,
                String value)
Parameters:
key -
value -

contains

public boolean contains(String key)
Parameters:
key -
Returns:
true if it contains the option

get

public String get(String key)
Parameters:
key -
Returns:
the option value or null

forFile

public static RasterIOOptions forFile(File file)
Return a RasterIOOption object with the format set according to the given file.

Parameters:
file -
Returns:
RasterIOOption proper format.

forFile

public static RasterIOOptions forFile(File file,
                                      RasterGeoReference envelope)
Return a RasterIOOption object with the format set according to the given file with an optional RasterGeoReference.

Parameters:
file -
envelope -
Returns:
RasterIOOption proper format.

toString

public String toString()
Overrides:
toString in class Object

readWorldFile

public boolean readWorldFile()
Returns:
true if the RasterReader should read the corresponding worldfile.

getLoadingPolicy

public RasterDataContainerFactory.LoadingPolicy getLoadingPolicy()
Returns:
the loading policy (and thus the raster data container) of the RasterDataFactory.

hasRasterGeoReference

public boolean hasRasterGeoReference()
Returns:
true if the options contain a raster geo reference.

getRasterGeoReference

public RasterGeoReference getRasterGeoReference()
Returns:
the raster geo reference

setRasterGeoReference

public void setRasterGeoReference(RasterGeoReference geoRef)
Parameters:
geoRef - the raster geo reference to use for the loaded raster.

getNoDataValue

public byte[] getNoDataValue()
Returns the no data value. A no data value should be added to the RasterIOOptions by using setNoData(byte[]). The byte[] can be created from an array of Strings by using the createNoData(String[], DataType).

Returns:
the no data values for the bands of the raster or null if no data was specified.

getRasterOriginLocation

public RasterGeoReference.OriginLocation getRasterOriginLocation()
Returns:
the location of the origin of the read file. If not defined this method will return return RasterGeoReference.OriginLocation#CENTER;

getCRS

public ICRS getCRS()
Returns:
the defined crs or null if no crs was defined.

setNoData

public void setNoData(byte[] noDataValue)
no data value. The byte[] can be created from an array of Strings by using the createNoData(String[], DataType).

Parameters:
noDataValue - containing byte representations of the rasters no data value.

createNoData

public static byte[] createNoData(String[] bandValues,
                                  DataType type)
                           throws NumberFormatException
Create a noData array from the given strings. Each string will be interpreted as the given type.

Parameters:
bandValues - String representations of each bands no data value e.g {10.0, 80.5, -100} for a 3 band float raster.
type - of the no data values.
Returns:
a byte array containing the no data values for each band, the bytes can be 'reversed' by using the ByteBuffer methods. If either the type or the array is null null will be returned.
Throws:
NumberFormatException - if one of the Strings could not be decoded.

copyOf

public RasterIOOptions copyOf(RasterIOOptions otherOptions)
Copies the the values from the given options.

Parameters:
otherOptions -


Copyright © 2011. All Rights Reserved.