org.geotools.io.coverage
Class PropertyParser

java.lang.Object
  extended byorg.geotools.io.coverage.PropertyParser

Deprecated. Replaced by org.geotools.coverage.io.PropertyParser.

public class PropertyParser
extends java.lang.Object

Helper class for creating OpenGIS's object from a set of properties. Properties are key-value pairs, for example "Units=meters". There is a wide variety of ways to contruct OpenGIS's objects from key-value pairs, and supporting them is not always straightforward. The PropertyParser class try to make the work easier. It defines a set of format-neutral keys (i.e. keys not related to any file format in particular). Before parsing a file, the mapping between format-neutral keys and "real" keys used in a particuler file format must be specified. This mapping is constructed with calls to addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String). For example, one may want to parse the following informations:

 XMinimum           = 217904.31
 YMaximum           = 5663495.1
 XResolution        = 1000.0000
 YResolution        = 1000.0000
 Units              = meters
 Projection         = Mercator_1SP
 Central meridian   = -15.2167
 Latitude of origin =  28.0667
 False easting      = 0.00000000
 False northing     = 0.00000000
 Ellipsoid          = Clarke 1866
 Datum              = Clarke 1866
 
Before to be used for parsing such informations, a PropertyParser object must be setup using the following code:
 addAlias(X_MINIMUM,    "XMinimum");
 addAlias(Y_MAXIMUM,    "YMaximum");
 addAlias(X_RESOLUTION, "XResolution");
 addAlias(Y_RESOLUTION, "YResolution");
 // etc...
 
Once the mapping is etablished, PropertyParser provides a set of getXXX() methods for constructing various objects from those informations. For example, the getCoordinateSystem() method constructs a CoordinateSystem object using available informations.

Version:
$Id: PropertyParser.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Nested Class Summary
static class PropertyParser.Key
          Deprecated. A key for fetching property in a format independent way.
 
Field Summary
static PropertyParser.Key CENTRAL_MERIDIAN
          Deprecated. Key for the "central_meridian" projection parameter.
static PropertyParser.Key COORDINATE_SYSTEM_NAME
          Deprecated. Optional Key for the coordinate system name.
static PropertyParser.Key DATUM
          Deprecated. Key for the coordinate system datum.
static PropertyParser.Key DEPTH
          Deprecated. Key for the image's "depth" in pixels.
static PropertyParser.Key ELLIPSOID
          Deprecated. Key for the coordinate system ellipsoid.
static PropertyParser.Key FALSE_EASTING
          Deprecated. Key for the "false_easting" projection parameter.
static PropertyParser.Key FALSE_NORTHING
          Deprecated. Key for the "false_northing" projection parameter.
static PropertyParser.Key HEIGHT
          Deprecated. Key for the image's height in pixels.
static PropertyParser.Key LATITUDE_OF_ORIGIN
          Deprecated. Key for the "latitude_of_origin" projection parameter.
static PropertyParser.Key PROJECTION
          Deprecated. Key for the projection classification.
static PropertyParser.Key PROJECTION_NAME
          Deprecated. Optional key for the projection name.
static PropertyParser.Key SEMI_MAJOR
          Deprecated. Key for the "semi_major" projection parameter.
static PropertyParser.Key SEMI_MINOR
          Deprecated. Key for the "semi_minor" projection parameter.
static PropertyParser.Key UNITS
          Deprecated. Key for the coordinate system axis units.
static PropertyParser.Key WIDTH
          Deprecated. Key for the image's width in pixels.
static PropertyParser.Key X_MAXIMUM
          Deprecated. Key for the maximal x value (eastern limit).
static PropertyParser.Key X_MINIMUM
          Deprecated. Key for the minimal x value (western limit).
static PropertyParser.Key X_RESOLUTION
          Deprecated. Key for the resolution among the x axis.
static PropertyParser.Key Y_MAXIMUM
          Deprecated. Key for the maximal y value (northern limit).
static PropertyParser.Key Y_MINIMUM
          Deprecated. Key for the minimal y value (southern limit).
static PropertyParser.Key Y_RESOLUTION
          Deprecated. Key for the resolution among the y axis.
static PropertyParser.Key Z_MAXIMUM
          Deprecated. Key for the maximal z value.
static PropertyParser.Key Z_MINIMUM
          Deprecated. Key for the minimal z value.
static PropertyParser.Key Z_RESOLUTION
          Deprecated. Key for the resolution among the z axis.
 
Constructor Summary
PropertyParser()
          Deprecated. Construct a new PropertyParser using the default CoordinateSystemFactory.
PropertyParser(CoordinateSystemFactory factory)
          Deprecated. Construct a new PropertyParser using the specified CoordinateSystemFactory.
 
Method Summary
 void add(GridCoverage coverage)
          Deprecated. Add all properties from the specified grid coverage.
 void add(javax.media.jai.PropertySource properties, java.lang.String prefix)
          Deprecated. Add properties from the specified property source.
 void add(java.awt.image.RenderedImage image)
          Deprecated. Add all properties from the specified image.
 void add(java.lang.String alias, java.lang.Object value)
          Deprecated. Add a property for the specified key.
 void addAlias(PropertyParser.Key key, java.lang.String alias)
          Deprecated. Add an alias to a key.
 void clear()
          Deprecated. Clear this property set.
 boolean contains(PropertyParser.Key key)
          Deprecated. Check if this PropertyParser contains a value for the specified key.
 java.lang.Object get(PropertyParser.Key key)
          Deprecated. Returns the property for the specified key.
 java.lang.String[] getAlias(PropertyParser.Key key)
          Deprecated. Returns the list of alias for the specified key, or null if the key has no alias.
 java.util.Date getAsDate(PropertyParser.Key key)
          Deprecated. Returns a property as a Date value.
 double getAsDouble(PropertyParser.Key key)
          Deprecated. Returns a property as a double value.
 int getAsInt(PropertyParser.Key key)
          Deprecated. Returns a property as a int value.
 CoordinateSystem getCoordinateSystem()
          Deprecated. Returns the coordinate system.
 HorizontalDatum getDatum()
          Deprecated. Returns the datum.
 Ellipsoid getEllipsoid()
          Deprecated. Returns the ellipsoid.
 Envelope getEnvelope()
          Deprecated. Returns the envelope.
 java.lang.String getFormatPattern(java.lang.Class type)
          Deprecated. Returns the pattern used for parsing and formatting values of the specified type.
 Envelope getGeographicEnvelope()
          Deprecated. Convenience method returning the envelope in geographic coordinate system using WGS 1984 datum.
 GridRange getGridRange()
          Deprecated. Returns the grid range.
 java.util.Locale getLocale()
          Deprecated. Returns the locale to use when parsing property values as numbers, angles or dates.
 Projection getProjection()
          Deprecated. Returns the projection.
 SampleDimension[] getSampleDimensions()
          Deprecated. Returns the sample dimensions for each band of the GridCoverage to be read.
 java.lang.String getSeparator()
          Deprecated. Returns the characters to use as separator between keys and values.
 java.lang.String getSource()
          Deprecated. Returns the source file name or URL.
 Unit getUnits()
          Deprecated. Returns the units.
 void listProperties(java.io.Writer out)
          Deprecated. List all properties to the specified stream.
protected  void load(java.io.BufferedReader in)
          Deprecated. Read all properties from a stream.
 void load(java.io.File header)
          Deprecated. Read all properties from a text file.
 void load(java.net.URL header)
          Deprecated. Read all properties from an URL.
protected  boolean parseLine(java.lang.String line)
          Deprecated. Parse a line and add the key-value pair to this property set.
 void setFormatPattern(java.lang.Class type, java.lang.String pattern)
          Deprecated. Set the pattern to use for parsing and formatting values of the specified type.
 void setSeparator(java.lang.String separator)
          Deprecated. Set the characters to use as separator between keys and values.
 java.lang.String toString()
          Deprecated. Returns a string representation of this properties set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNITS

public static final PropertyParser.Key UNITS
Deprecated. 
Key for the coordinate system axis units. The getUnits() method looks for this property. Its return value is used by getCoordinateSystem() as below:

See Also:
DATUM, ELLIPSOID, PROJECTION

DATUM

public static final PropertyParser.Key DATUM
Deprecated. 
Key for the coordinate system datum. The getDatum() method looks for this property. Its return value is used by getCoordinateSystem().

See Also:
UNITS, ELLIPSOID, PROJECTION

ELLIPSOID

public static final PropertyParser.Key ELLIPSOID
Deprecated. 
Key for the coordinate system ellipsoid. The getEllipsoid() method looks for this property. Its return value is used by getProjection().

See Also:
UNITS, DATUM, PROJECTION

PROJECTION

public static final PropertyParser.Key PROJECTION
Deprecated. 
Key for the projection classification. This is the classification name required by CoordinateSystemFactory.createProjection(...). The getProjection() method looks for this property. Its return value is used by getCoordinateSystem().

See Also:
SEMI_MAJOR, SEMI_MINOR, LATITUDE_OF_ORIGIN, CENTRAL_MERIDIAN, FALSE_EASTING, FALSE_NORTHING

PROJECTION_NAME

public static final PropertyParser.Key PROJECTION_NAME
Deprecated. 
Optional key for the projection name. The getProjection() method looks for this property, if presents. The projection name is used for documentation purpose only. If it is not defined, then the projection name will be the same than the classification name.

See Also:
PROJECTION, COORDINATE_SYSTEM_NAME

COORDINATE_SYSTEM_NAME

public static final PropertyParser.Key COORDINATE_SYSTEM_NAME
Deprecated. 
Optional Key for the coordinate system name. The getCoordinateSystem() method looks for this property.

See Also:
PROJECTION_NAME

SEMI_MAJOR

public static final PropertyParser.Key SEMI_MAJOR
Deprecated. 
Key for the "semi_major" projection parameter. There is no specific method for this key. However, this key may be queried indirectly by getProjection().

See Also:
SEMI_MINOR, LATITUDE_OF_ORIGIN, CENTRAL_MERIDIAN, FALSE_EASTING, FALSE_NORTHING, PROJECTION

SEMI_MINOR

public static final PropertyParser.Key SEMI_MINOR
Deprecated. 
Key for the "semi_minor" projection parameter. There is no specific method for this key. However, this key may be queried indirectly by getProjection().

See Also:
SEMI_MAJOR, LATITUDE_OF_ORIGIN, CENTRAL_MERIDIAN, FALSE_EASTING, FALSE_NORTHING, PROJECTION

LATITUDE_OF_ORIGIN

public static final PropertyParser.Key LATITUDE_OF_ORIGIN
Deprecated. 
Key for the "latitude_of_origin" projection parameter. There is no specific method for this key. However, this key may be queried indirectly by getProjection().

See Also:
SEMI_MAJOR, SEMI_MINOR, CENTRAL_MERIDIAN, FALSE_EASTING, FALSE_NORTHING, PROJECTION

CENTRAL_MERIDIAN

public static final PropertyParser.Key CENTRAL_MERIDIAN
Deprecated. 
Key for the "central_meridian" projection parameter. There is no specific method for this key. However, this key may be queried indirectly by getProjection().

See Also:
SEMI_MAJOR, SEMI_MINOR, LATITUDE_OF_ORIGIN, FALSE_EASTING, FALSE_NORTHING, PROJECTION

FALSE_EASTING

public static final PropertyParser.Key FALSE_EASTING
Deprecated. 
Key for the "false_easting" projection parameter. There is no specific method for this key. However, this key may be queried indirectly by getProjection().

See Also:
SEMI_MAJOR, SEMI_MINOR, LATITUDE_OF_ORIGIN, CENTRAL_MERIDIAN, FALSE_NORTHING, PROJECTION

FALSE_NORTHING

public static final PropertyParser.Key FALSE_NORTHING
Deprecated. 
Key for the "false_northing" projection parameter. There is no specific method for this key. However, this key may be queried indirectly by getProjection().

See Also:
SEMI_MAJOR, SEMI_MINOR, LATITUDE_OF_ORIGIN, CENTRAL_MERIDIAN, FALSE_EASTING, PROJECTION

X_MINIMUM

public static final PropertyParser.Key X_MINIMUM
Deprecated. 
Key for the minimal x value (western limit). This is usually the longitude coordinate of the upper left corner. The getEnvelope() method looks for this property in order to set the minimal coordinate for dimension 0.

See Also:
X_MAXIMUM, Y_MINIMUM, Y_MAXIMUM, X_RESOLUTION, Y_RESOLUTION

Y_MINIMUM

public static final PropertyParser.Key Y_MINIMUM
Deprecated. 
Key for the minimal y value (southern limit). This is usually the latitude coordinate of the bottom right corner. The getEnvelope() method looks for this property. in order to set the minimal coordinate for dimension 1.

See Also:
X_MINIMUM, X_MAXIMUM, Y_MAXIMUM, X_RESOLUTION, Y_RESOLUTION

Z_MINIMUM

public static final PropertyParser.Key Z_MINIMUM
Deprecated. 
Key for the minimal z value. This is usually the minimal altitude. The getEnvelope() method looks for this property in order to set the minimal coordinate for dimension 2.

See Also:
Z_MAXIMUM, Z_RESOLUTION, DEPTH

X_MAXIMUM

public static final PropertyParser.Key X_MAXIMUM
Deprecated. 
Key for the maximal x value (eastern limit). This is usually the longitude coordinate of the bottom right corner. The getEnvelope() method looks for this property in order to set the maximal coordinate for dimension 0.

See Also:
X_MINIMUM, Y_MINIMUM, Y_MAXIMUM, X_RESOLUTION, Y_RESOLUTION

Y_MAXIMUM

public static final PropertyParser.Key Y_MAXIMUM
Deprecated. 
Key for the maximal y value (northern limit). This is usually the latitude coordinate of the upper left corner. The getEnvelope() method looks for this property in order to set the maximal coordinate for dimension 1.

See Also:
X_MINIMUM, X_MAXIMUM, Y_MINIMUM, X_RESOLUTION, Y_RESOLUTION

Z_MAXIMUM

public static final PropertyParser.Key Z_MAXIMUM
Deprecated. 
Key for the maximal z value. This is usually the maximal altitude. The getEnvelope() method looks for this property in order to set the maximal coordinate for dimension 2.

See Also:
Z_MINIMUM, Z_RESOLUTION, DEPTH

X_RESOLUTION

public static final PropertyParser.Key X_RESOLUTION
Deprecated. 
Key for the resolution among the x axis. The getEnvelope() method looks for this property in order to infer the coordinates for dimension 0.

See Also:
X_MINIMUM, X_MAXIMUM, Y_MINIMUM, Y_MAXIMUM, Y_RESOLUTION

Y_RESOLUTION

public static final PropertyParser.Key Y_RESOLUTION
Deprecated. 
Key for the resolution among the y axis. The getEnvelope() method looks for this property in order to infer the coordinates for dimension 1.

See Also:
X_MINIMUM, X_MAXIMUM, Y_MINIMUM, Y_MAXIMUM, X_RESOLUTION, WIDTH, HEIGHT

Z_RESOLUTION

public static final PropertyParser.Key Z_RESOLUTION
Deprecated. 
Key for the resolution among the z axis. The getEnvelope() method looks for this property in order to infer the coordinates for dimension 2.

See Also:
Z_MINIMUM, Z_MAXIMUM, DEPTH

WIDTH

public static final PropertyParser.Key WIDTH
Deprecated. 
Key for the image's width in pixels. The getGridRange() method looks for this property in order to infer the grid size along the dimension 0.

See Also:
HEIGHT, X_RESOLUTION, Y_RESOLUTION

HEIGHT

public static final PropertyParser.Key HEIGHT
Deprecated. 
Key for the image's height in pixels. The getGridRange() method looks for this property in order to infer the grid size along the dimension 1.

See Also:
WIDTH, X_RESOLUTION, Y_RESOLUTION

DEPTH

public static final PropertyParser.Key DEPTH
Deprecated. 
Key for the image's "depth" in pixels. This property may exists for 3D images, but some implementations accept at most 1 pixel depth among the third dimension. The getGridRange() method looks for this property in order to infer the grid size along the dimension 2.

See Also:
Z_MINIMUM, Z_MAXIMUM, Z_RESOLUTION
Constructor Detail

PropertyParser

public PropertyParser()
Deprecated. 
Construct a new PropertyParser using the default CoordinateSystemFactory.


PropertyParser

public PropertyParser(CoordinateSystemFactory factory)
Deprecated. 
Construct a new PropertyParser using the specified CoordinateSystemFactory.

Method Detail

getSeparator

public java.lang.String getSeparator()
Deprecated. 
Returns the characters to use as separator between keys and values. Leading and trailing spaces will be keep when formatting with listProperties(java.io.Writer), but will be ignored when parsing with parseLine(java.lang.String). The default value is " = ".


setSeparator

public void setSeparator(java.lang.String separator)
Deprecated. 
Set the characters to use as separator between keys and values.


getFormatPattern

public java.lang.String getFormatPattern(java.lang.Class type)
Deprecated. 
Returns the pattern used for parsing and formatting values of the specified type. The type should be either Number.class or Date.class. if type is assignable to Number.class, then this method returns the number pattern as specified by DecimalFormat. Otherwise, if type is assignable to Date.class, then this method returns the date pattern as specified by SimpleDateFormat. In any case, this method returns null if this object should use the default pattern for the data locale.

Parameters:
type - The data type (Number.class or Date.class).
Returns:
The format pattern for the specified data type, or null for the default locale-dependent pattern.
Throws:
IllegalArgumentException - if type is not valid.

setFormatPattern

public void setFormatPattern(java.lang.Class type,
                             java.lang.String pattern)
Deprecated. 
Set the pattern to use for parsing and formatting values of the specified type. The type should be either Number.class or Date.class.

Parameters:
type - The data type (Number.class or Date.class).
pattern - The format pattern for the specified data type, or null for the default locale-dependent pattern.
Throws:
IllegalArgumentException - if type is not valid.

clear

public void clear()
Deprecated. 
Clear this property set. If the same PropertyParser object is used for parsing many files, then clear() should be invoked prior any load(...) method. Note that clear() do not remove any alias, so this PropertyParser can been immediately reused for parsing new files of the same kind.


load

public void load(java.io.File header)
          throws java.io.IOException
Deprecated. 
Read all properties from a text file. The default implementation invokes load(BufferedReader). Note that this method do not invokes clear() prior the loading. Consequently, the loaded properties will be added to the set of existing properties.

Parameters:
header - The file to read until EOF.
Throws:
IOException - if an error occurs during loading.
See Also:
clear(), load(URL), parseLine(java.lang.String), getSource()

load

public void load(java.net.URL header)
          throws java.io.IOException
Deprecated. 
Read all properties from an URL. The default implementation invokes load(BufferedReader). Note that this method do not invokes clear() prior the loading. Consequently, the loaded properties will be added to the set of existing properties.

Parameters:
header - The URL to read until EOF.
Throws:
IOException - if an error occurs during loading.
See Also:
clear(), load(File), parseLine(java.lang.String), getSource()

load

protected void load(java.io.BufferedReader in)
             throws java.io.IOException
Deprecated. 
Read all properties from a stream. The default implementation invokes parseLine(java.lang.String) for each non-empty line found in the stream. Notes:

Parameters:
in - The stream to read until EOF. The stream will not be closed.
Throws:
IOException - if an error occurs during loading.
See Also:
clear(), load(File), load(URL), parseLine(java.lang.String)

parseLine

protected boolean parseLine(java.lang.String line)
                     throws javax.imageio.IIOException
Deprecated. 
Parse a line and add the key-value pair to this property set. The default implementation take the substring on the left size of the first separator (usually the '=' character) as the key, and the substring on the right size of separator as the value. For example, if line has the following value:
 Ellipsoid = WGS 1984
 
Then, the default implementation will translate this line in the following call:
 add("Ellipsoid", "WGS 1984");
 
This method returns true if it has consumed the line, or false otherwise. A line is "consumed" if parseLine has either added the key-value pair (using add(org.geotools.gc.GridCoverage)), or determined that the line must be ignored (for example because parseLine detected a character announcing a comment line). A "consumed" line will not receive any further treatment. The line is not consumed (i.e. this method returns false) if parseLine don't know what to do with it. Non-consumed line will typically go up in a chain of parseLine methods (if PropertyParser has been subclassed) until someone consume it.

Parameters:
line - The line to parse.
Returns:
true if this method has consumed the line.
Throws:
IIOException - if the line is badly formatted.
AmbiguousPropertyException - if a different value was already defined for the same property name.
See Also:
load(File), load(URL), add(String,Object)

add

public void add(GridCoverage coverage)
         throws AmbiguousPropertyException
Deprecated. 
Add all properties from the specified grid coverage. This convenience method can be used together with listProperties(java.io.Writer) as a way to format the properties for an arbitrary grid coverage. The default implementation performs the following step:

add

public void add(java.awt.image.RenderedImage image)
         throws AmbiguousPropertyException
Deprecated. 
Add all properties from the specified image.

Parameters:
image - The image with properties to add to this PropertyParser.
Throws:
AmbiguousPropertyException - if a property is defined twice.
See Also:
add(GridCoverage), add(PropertySource,String), add(String,Object)

add

public void add(javax.media.jai.PropertySource properties,
                java.lang.String prefix)
         throws AmbiguousPropertyException
Deprecated. 
Add properties from the specified property source.

Parameters:
properties - The properties source.
prefix - The prefix for properties to add, of null to add all properties. If non-null, only properties begining with this prefix will be added.
Throws:
AmbiguousPropertyException - if a property is defined twice.
See Also:
add(GridCoverage), add(RenderedImage), add(String,Object)

add

public void add(java.lang.String alias,
                java.lang.Object value)
         throws AmbiguousPropertyException
Deprecated. 
Add a property for the specified key. Keys are case-insensitive, ignore leading and trailing whitespaces and consider any other whitespace sequences as equal to a single '_' character.

Parameters:
alias - The key for the property to add. This is usually the name found in the file to be parsed (this is different from PropertyParser.Key objects, which are keys in a format neutral way). This key is usually, but not always, one of the alias defined with addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String).
value - The value for the property to add. If null or Image.UndefinedProperty, then this method do nothing.
Throws:
AmbiguousPropertyException - if a different value already exists for the specified alias, or for an other alias bound to the same PropertyParser.Key.
See Also:
add(GridCoverage), add(RenderedImage), add(PropertySource,String), parseLine(java.lang.String)

addAlias

public void addAlias(PropertyParser.Key key,
                     java.lang.String alias)
              throws AmbiguousPropertyException
Deprecated. 
Add an alias to a key. After this method has been invoked, calls to get(key) will really looks for property named alias. Alias are mandatory in order to get various getXXX() methods to work for a particular file format. For example if the file to be parsed uses the names "ULX" and "ULY" for the coordinate of the upper left corner, then the getEnvelope() method will not work unless the following alias are set:
 addAlias(X_MINIMUM, "ULX");
 addAlias(Y_MAXIMUM, "ULY");
 
An arbitrary number of alias can be set for the same key. For example, addAlias(Y_MAXIMUM, ...) could be invoked twice with "ULY" and "Limit North" alias. The getXXX() methods will try alias in the order they were added and use the first value found.

The same alias can also be set to more than one key. For example, the following code is legal. It said that pixel are square with the same horizontal and vertical resolution:
 addAlias(X_RESOLUTION, "Resolution");
 addAlias(Y_RESOLUTION, "Resolution");
 

Parameters:
key - The key to add an alias. This key is format neutral.
alias - The alias to add. This is the name actually used in the file to be parsed. Alias are case insensitive and ignore multiple whitespace, like keys. If this alias is already bound to the specified key, then this method do nothing.
Throws:
AmbiguousPropertyException - if the addition of the supplied alias would introduce an ambiguity in the current set of properties. This occurs if the key has already an alias mapping to a different value.
See Also:
getAlias(org.geotools.io.coverage.PropertyParser.Key), contains(org.geotools.io.coverage.PropertyParser.Key), get(org.geotools.io.coverage.PropertyParser.Key)

contains

public boolean contains(PropertyParser.Key key)
Deprecated. 
Check if this PropertyParser contains a value for the specified key. Invoking get(org.geotools.io.coverage.PropertyParser.Key) will thrown a MissingPropertyException if and only if contains(org.geotools.io.coverage.PropertyParser.Key) returns false for the same key.

Parameters:
key - The key to test for inclusion in this PropertyParser.
Returns:
true if the given key was found.
See Also:
get(org.geotools.io.coverage.PropertyParser.Key), addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)

get

public java.lang.Object get(PropertyParser.Key key)
                     throws MissingPropertyException
Deprecated. 
Returns the property for the specified key. This method expect a format neutral, case insensitive PropertyParser.Key argument. In order to maps the key to the actual name used in the underlying metadata file, the method addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String) must have been invoked prior to any get method.

Parameters:
key - The key of the desired property. Keys are case insensitive and format neutral.
Returns:
Value for the specified key (never null).
Throws:
MissingPropertyException - if no value exists for the specified key.
See Also:
getAsDouble(org.geotools.io.coverage.PropertyParser.Key), getAsInt(org.geotools.io.coverage.PropertyParser.Key), contains(org.geotools.io.coverage.PropertyParser.Key), addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)

getAsDouble

public double getAsDouble(PropertyParser.Key key)
                   throws PropertyException
Deprecated. 
Returns a property as a double value. The default implementation invokes get(key) and parse the resulting value with NumberFormat.parse(String) for the current locale.

Parameters:
key - The key of the desired property. Keys are case-insensitive.
Returns:
Value for the specified key as a double.
Throws:
MissingPropertyException - if no value exists for the specified key.
PropertyException - if the value can't be parsed as a double.
See Also:
getAsInt(org.geotools.io.coverage.PropertyParser.Key), get(org.geotools.io.coverage.PropertyParser.Key), contains(org.geotools.io.coverage.PropertyParser.Key), addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)

getAsInt

public int getAsInt(PropertyParser.Key key)
             throws PropertyException
Deprecated. 
Returns a property as a int value. The default implementation invokes getAsDouble(key) and make sure that the resulting value is an integer.

Parameters:
key - The key of the desired property. Keys are case-insensitive.
Returns:
Value for the specified key as an int.
Throws:
MissingPropertyException - if no value exists for the specified key.
PropertyException - if the value can't be parsed as an int.
See Also:
getAsDouble(org.geotools.io.coverage.PropertyParser.Key), get(org.geotools.io.coverage.PropertyParser.Key), contains(org.geotools.io.coverage.PropertyParser.Key), addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)

getAsDate

public java.util.Date getAsDate(PropertyParser.Key key)
                         throws PropertyException
Deprecated. 
Returns a property as a Date value. The default implementation invokes get(key) and parse the resulting value with DateFormat.parse(String) for the current locale.

Parameters:
key - The key of the desired property. Keys are case-insensitive.
Returns:
Value for the specified key as a Date.
Throws:
MissingPropertyException - if no value exists for the specified key.
PropertyException - if the value can't be parsed as a date.

getAlias

public java.lang.String[] getAlias(PropertyParser.Key key)
Deprecated. 
Returns the list of alias for the specified key, or null if the key has no alias. Alias are the names used in the underlying metadata file, and are format dependent.

Parameters:
key - The format neutral key.
Returns:
The alias for the specified key, or null if none.
See Also:
addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)

getSource

public java.lang.String getSource()
                           throws PropertyException
Deprecated. 
Returns the source file name or URL. This is the path specified during the last call to a load(...) method.

Returns:
The source file name or URL.
Throws:
PropertyException - if this information can't be fetched.

getLocale

public java.util.Locale getLocale()
                           throws PropertyException
Deprecated. 
Returns the locale to use when parsing property values as numbers, angles or dates. This is not the locale used for formatting error messages, if any. The default implementation returns Locale.US, since it is the format used in most data file.

Returns:
The locale to use for parsing property values.
Throws:
PropertyException - if this information can't be fetched.
See Also:
getAsDouble(org.geotools.io.coverage.PropertyParser.Key), getAsInt(org.geotools.io.coverage.PropertyParser.Key), getAsDate(org.geotools.io.coverage.PropertyParser.Key)

getUnits

public Unit getUnits()
              throws PropertyException
Deprecated. 
Returns the units. The default implementation invokes get(UNITS) and transform the resulting string into an Unit object.

Throws:
MissingPropertyException - if no value exists for the UNITS key.
PropertyException - if the operation failed for some other reason.
See Also:
getCoordinateSystem()

getDatum

public HorizontalDatum getDatum()
                         throws PropertyException
Deprecated. 
Returns the datum. The default implementation invokes get(DATUM) and transform the resulting string into a HorizontalDatum object.

Throws:
MissingPropertyException - if no value exists for the DATUM key.
PropertyException - if the operation failed for some other reason.
See Also:
getCoordinateSystem(), getEllipsoid()

getEllipsoid

public Ellipsoid getEllipsoid()
                       throws PropertyException
Deprecated. 
Returns the ellipsoid. The default implementation invokes get(ELLIPSOID) and transform the resulting string into an Ellipsoid object.

Throws:
MissingPropertyException - if no value exists for the ELLIPSOID key.
PropertyException - if the operation failed for some other reason.
See Also:
getCoordinateSystem(), getDatum()

getProjection

public Projection getProjection()
                         throws PropertyException
Deprecated. 
Returns the projection. The default implementation performs the following steps:

Returns:
The projection, or null if the underlying coordinate system is not a ProjectedCoordinateSystem.
Throws:
MissingPropertyException - if no value exists for the PROJECTION key.
PropertyException - if the operation failed for some other reason (for example if a parameter value can't be parsed as a double).
See Also:
getCoordinateSystem(), SEMI_MAJOR, SEMI_MINOR, LATITUDE_OF_ORIGIN, CENTRAL_MERIDIAN, FALSE_EASTING, FALSE_NORTHING

getCoordinateSystem

public CoordinateSystem getCoordinateSystem()
                                     throws PropertyException
Deprecated. 
Returns the coordinate system. The default implementation construct a coordinate system from the information provided by getUnits(), getDatum() and getProjection(). The coordinate system name (optional) will be fetch from property COORDINATE_SYSTEM_NAME, if presents.

Throws:
MissingPropertyException - if a required value is missing (e.g. PROJECTION, DATUM, UNITS, etc.).
PropertyException - if the operation failed for some other reason.
See Also:
getUnits(), getDatum(), getProjection()

getGeographicEnvelope

public Envelope getGeographicEnvelope()
                               throws PropertyException
Deprecated. 
Convenience method returning the envelope in geographic coordinate system using WGS 1984 datum.

Throws:
PropertyException - if the operation failed. This exception may contains a TransformException as its cause.
See Also:
getEnvelope(), getGridRange()

getEnvelope

public Envelope getEnvelope()
                     throws PropertyException
Deprecated. 
Returns the envelope. Default implementation construct an Envelope object using the values from the following keys:

Throws:
MissingPropertyException - if a required value is missing.
PropertyException - if the operation failed for some other reason.
See Also:
getGridRange(), getGeographicEnvelope()

getGridRange

public GridRange getGridRange()
                       throws PropertyException
Deprecated. 
Returns the grid range. Default implementation fetchs the property values for keys WIDTH and HEIGHT, and transform the resulting strings into a GridRange object.

Throws:
MissingPropertyException - if a required value is missing.
PropertyException - if the operation failed for some other reason.
See Also:
getEnvelope(), getGeographicEnvelope()

getSampleDimensions

public SampleDimension[] getSampleDimensions()
                                      throws PropertyException
Deprecated. 
Returns the sample dimensions for each band of the GridCoverage to be read. If sample dimensions are not know, then this method returns null. The default implementation always returns null.

Throws:
PropertyException - if the operation failed.

listProperties

public void listProperties(java.io.Writer out)
                    throws java.io.IOException
Deprecated. 
List all properties to the specified stream. The default implementation list the properties as key = value pairs. Each pair is formatted on its own line, and the caracter '=' is inserted between keys and values. A question mark ('?') is put in front of any unknow name (i.e. any name not specified with addAlias(org.geotools.io.coverage.PropertyParser.Key, java.lang.String)).

Parameters:
out - Stream to write properties to.
Throws:
IOException - if an error occured while listing properties.
See Also:
add(GridCoverage), toString()

toString

public java.lang.String toString()
Deprecated. 
Returns a string representation of this properties set. The default implementation write the class name and the envelope in geographic coordinates, as returned by getGeographicEnvelope(). Then, it append the list of all properties as formatted by listProperties(java.io.Writer).



Copyright © GeoTools. All Rights Reserved.